Win a copy of Design for the Mind this week in the Design forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

how to get selected value from s:select tag in struts 2

 
sunil gupta
Greenhorn
Posts: 21
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi,

i m new to struts to and got stuch at this.

how to get selected value from <s:select> tag in struts 2.

regards
Sunil
 
sunil gupta
Greenhorn
Posts: 21
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
This post has been solved.

just create get and set method witht he same name as the name of select tag.

then set the getlist() and setlist().

in the jsp page use function getlist and it will give back whateve is selected in the select list.

thanks
Sunil
 
prabhu pandurangan
Ranch Hand
Posts: 147
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Sunil,
Im new to struts 2, how to get the selected <s:select> value on onchange event using javascript.

Also sunil, if you have done any sample application using struts 2, Please send me those. Im in need of it.



Regards,
Prabhu.
 
thedancingllama
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Just an FYI, this was plaguing me for a little while,
but in order for the select list to set the selected value, you need the params interceptor (or default interceptor stack) defined in your struts.xml in order for the setter(s) to work in your action.
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 64702
86
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
"thedancingllama", please check your private messages for an important administrative matter.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic