File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/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
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: How to retrive values from <s:select> tag which is populated with data from the database in struts2.
 
Similar Threads
Struts2 UI Tags Not Aligned On Browser
How to Validate duplicate entries in database using struts1
Struts 2 JCaptchaforStruts 2 issue
Need to know if I am doing this right or not
How to valdate password and confirm password using validation framework in struts2?