| 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: 676
|
|
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
|
 |
 |
|
|
subject: How to retrive values from <s:select> tag which is populated with data from the database in struts2.
|
|
|