This week's book giveaway is in the Servlets forum.
We're giving away four copies of Murach's Java Servlets and JSP and have Joel Murach on-line!
See this thread for details.
The moose likes Struts and the fly likes Question Re: html:OptionsCollection Tag Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "Question Re: html:OptionsCollection Tag" Watch "Question Re: html:OptionsCollection Tag" New topic
Author

Question Re: html:OptionsCollection Tag

Jason Ferguson
Ranch Hand

Joined: Aug 09, 2007
Posts: 58
I have a JSP defined with using the <html ptionsCollection> tag from the Struts tag library. The code looks something like this:


Unfortunately, the label only puts out the single value, "projectId" (think a select box that just says "166").

Is there any way to adjust the properties of the label, so that maybe the value of the label might have some type of text appended to it? I doubt it is possible, but was wondering...

Jason
Merrill Higginson
Ranch Hand

Joined: Feb 15, 2005
Posts: 4864
I'd suggest you add a getter method to the JavaBean you're using in your collection named something like getLabelForProject(). then have this method return whatever it is you want to be displayed. Then simply spcify label="labelForProject" in your optionsCollection tag.


Merrill
Consultant, Sima Solutions
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Question Re: html:OptionsCollection Tag
 
Similar Threads
java. lang. IllegalArgumentException: No Bean specified, help me to resolve
Populating 'html:select' with values in Database
Useing Constants in Tag's
How to use html:select tag in struts
How to used Options Tag in Struts?