• 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
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

how to get label property from html:OptionsCollection

 
Ranch Hand
Posts: 276
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi All,
I have a <html:select > which is populated with a <html ptionsCollection>. The collection "groups" from the code snippet below is a list of LabelValue beans. I can get at the selected value in my struts action by using the the getGroupId method I put in my struts form. My question is , how do I get at the label ? For example, if the user selects the item of my collection ["groupxyz", 5], a call to getGroupID will return 5. I want to know how to get the "groupxyz" string from my struts action. I tried to add a member to the struts form called "groupName" thinking that struts would put the label value there, but got an error.

Here is the jsp code :



[ November 30, 2005: Message edited by: Kim Kantola ]

[ November 30, 2005: Message edited by: Kim Kantola ]
[ November 30, 2005: Message edited by: Kim Kantola ]
 
Greenhorn
Posts: 14
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I am getting the same type of problem that when I use opencollections then the label and value of the options are same.


I think I am doing something wrong in the java files can you please send me the sample java code for putting value in the collection so that label and value of options in the select are different
 
reply
    Bookmark Topic Watch Topic
  • New Topic