• 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:
  • Campbell Ritchie
  • Tim Cooke
  • Ron McLeod
  • paul wheaton
  • Jeanne Boyarsky
Sheriffs:
  • Paul Clapham
  • Devaka Cooray
Saloon Keepers:
  • Tim Holloway
  • Roland Mueller
  • Himai Minh
Bartenders:

how to get the selected value from a drop down to action

 
Ranch Hand
Posts: 123
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I have a list of values in a dropdoen box, I am using struts 2.0 and using the select tag as explained below,


Can anyone advise how to get the selected value to the action. I tried with a getter of strUserName but it is not working. Is there any other way?
 
Ranch Hand
Posts: 82
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Rahul,

Im using the following method,



where 'selectedcountry' is one of the property in actionform..

-HTH

regards,
kishore
 
Greenhorn
Posts: 13
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
hi i am using struts2 select tag for a dropdown list
after selecting a particular element i need to display that selected value in another jsp

my select tag is
<s:select name="country" label="Country" headerKey="3" headerValue="---Select One---" list="country"/>

how can i get the selected value?
 
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

rahulJ james wrote:I have a list of values in a dropdoen box, I am using struts 2.0 and using the select tag as explained below,

...there any other way?



Why aren't you using the struts2 tag library (select tag ref) ?
 
Author
Posts: 12617
IntelliJ IDE Ruby
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
He is--just using a very confusing and misleading taglib prefix.
 
rahulJ james
Ranch Hand
Posts: 123
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
What am I missing in my code, Can anyone advise. I am using the struts2 tag. I dont find property attribute for select tag.
 
David Newton
Author
Posts: 12617
IntelliJ IDE Ruby
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Because you were using a confusing and misleading tag prefix, one responder assumed you were using Struts 1. Which version of Struts are you using? If you're using Struts 2, as your attributes imply, I'd *strongly* urge you to use the default taglib prefix to avoid confusion. Not to mention that the "html" prefix doesn't make any sense for S2, since there are many tags that don't emit any HTML markup.

You need a *setter* for the property--not a getter. OGNL can't use a getter to set a value.
 
Don't get me started about those stupid light bulbs.
reply
    Bookmark Topic Watch Topic
  • New Topic