wood burning stoves 2.0*
The moose likes Struts and the fly likes how to get label property from html:OptionsCollection Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "how to get label property from html:OptionsCollection" Watch "how to get label property from html:OptionsCollection" New topic
Author

how to get label property from html:OptionsCollection

Kim Kantola
Ranch Hand

Joined: May 17, 2001
Posts: 274
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

Joined: Oct 12, 2005
Posts: 14
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
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: how to get label property from html:OptionsCollection