• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

How to iterate using struts 2 ?

 
angelin precilla
Ranch Hand
Posts: 33
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 9318
10
Linux Mac OS X Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
angelin precilla
Ranch Hand
Posts: 33
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
CAn you send me the sample example relevant to my query.
 
Joe Ess
Bartender
Posts: 9318
10
Linux Mac OS X Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Was my diagnosis of your problem correct?
Do you want to use AJAX or JavaScript to solve your problem?
 
angelin precilla
Ranch Hand
Posts: 33
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 9318
10
Linux Mac OS X Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic