aspose file tools*
The moose likes Struts and the fly likes How to retrive values from <s:select> tag which is populated with data from the database in struts2. Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "How to retrive values from <s:select> tag which is populated with data from the database in struts2." Watch "How to retrive values from <s:select> tag which is populated with data from the database in struts2." New topic
Author

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

Jyothsna Panchagnula
Ranch Hand

Joined: Jul 11, 2005
Posts: 113
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

Joined: Sep 07, 2008
Posts: 684



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.



Thanks, Nishan Patel
SCJP 1.5, SCWCD 1.5, OCPJWSD Java Developer,My Blog
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: How to retrive values from <s:select> tag which is populated with data from the database in struts2.