aspose file tools*
The moose likes Struts and the fly likes How to iterate using struts 2 ? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "How to iterate using struts 2 ?" Watch "How to iterate using struts 2 ?" New topic
Author

How to iterate using struts 2 ?

angelin precilla
Ranch Hand

Joined: Sep 11, 2007
Posts: 33
Hi all,
I am new to struts 2. I have a method which returns arraylist, where as the array list containd collection of VO's.
How to get iterate it in jsp using struts 2 ?
example:
In this example, DataBaseDetails is my VO,which contains variuos fields like portno,database name,etc....



All the database names like mysql,oracle,derby will be populated in the combo box. I need to populate the values like portno,username on clicking the value in the combo box.
[ March 17, 2008: Message edited by: angelin precilla ]
Joe Ess
Bartender

Joined: Oct 29, 2001
Posts: 8971
    
    9

All the database names like mysql,oracle,derby will be populated in the combo box. I need to populate the values like portno,username on clicking the value in the combo box.


So you aren't really talking about iteration as your topic title says. You want to know how you can select a connection in a list and display the connection's properties in a couple of text boxes, right?
Struts 2 has some AJAX functionality that could be used to fetch the values for the text boxes once a select box value is selected.
Another way to do this is to populate several Javascript arrays with the values for port number, user name, etc. and put an onclick action on the select box which populates your text boxes when a value is selected.


[How To Ask Questions On JavaRanch]
angelin precilla
Ranch Hand

Joined: Sep 11, 2007
Posts: 33
Hi,
CAn you send me the sample example relevant to my query.
Joe Ess
Bartender

Joined: Oct 29, 2001
Posts: 8971
    
    9

Was my diagnosis of your problem correct?
Do you want to use AJAX or JavaScript to solve your problem?
angelin precilla
Ranch Hand

Joined: Sep 11, 2007
Posts: 33
HI,
I have used JSON to populate the textboxes.
But I am getting script error as 'Expected identifier,String or Number'
My code is

I am getting the alert statement correctly.
I am getting script error after the alert statement.

[ March 17, 2008: Message edited by: angelin precilla ]
[ March 17, 2008: Message edited by: angelin precilla ]
Joe Ess
Bartender

Joined: Oct 29, 2001
Posts: 8971
    
    9

You really need to read our FAQ, How To Ask Questions on JavaRanch
You are leaving out vital details about your problem and showing us source code that has nothing to do with your question. The better you frame your question, the more we will be able to help you, and the FAQ will help you do that.
 
jQuery in Action, 2nd edition
 
subject: How to iterate using struts 2 ?