• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Tim Cooke
  • Campbell Ritchie
  • paul wheaton
  • Ron McLeod
  • Devaka Cooray
Sheriffs:
  • Jeanne Boyarsky
  • Liutauras Vilda
  • Paul Clapham
Saloon Keepers:
  • Tim Holloway
  • Carey Brown
  • Piet Souris
Bartenders:

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

 
Ranch Hand
Posts: 113
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
Ranch Hand
Posts: 689
Scala Eclipse IDE Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.

reply
    Bookmark Topic Watch Topic
  • New Topic