Win a copy of Learn Spring Security (video course) this week in the Spring forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

How to retrive values from <s:select> tag which is populated with data from the database in struts2.

 
Jyothsna Panchagnula
Ranch Hand
Posts: 113
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi all,

I am populating countries list to a <s:select> tag in JSP during the page load.
The class using which I am populating countries contains all the getters and setters for the page.

My Question is how to retireve the form values once the use clicks on submit button.
ie do I need to write another class again with all the getters and setters ?

I am not able to crack this,
Can anyone please help me out?

My struts.xml file


My jsp



My Action class



Can any one please help me out?

thanks,
Jyothsna
 
Nishan Patel
Ranch Hand
Posts: 689
Eclipse IDE Java Scala
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator


Hi,

No matter which action you called just remember which action you called that have getter or setter of get the value of your variable.

like if you declare in Jsp <s:select name="country" .... />

then your called action contains country getter and setter method at your action.

Other wise you have to use old java method.

request.getparameter("country").

that also gives you value of your select combo box.

 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic