• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

how to get label property from html:OptionsCollection

 
Kim Kantola
Ranch Hand
Posts: 276
  • Mark post as helpful
  • send pies
  • 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 ]
 
pankajjj jain
Greenhorn
Posts: 14
  • Mark post as helpful
  • send pies
  • 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
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic