Thanks Keith - I probably didn't explain my problem well enough. I am not having problems with the <html:options> at all. The problem that I am having is that when I save an option in the database from my form, I save the "value" portion instead of the "label" portion of the option. The value is an integer, while the label is a string describing it. When I want to pull a record out of the database for display only, I have the integer saved in the database, which is not very useful for a user. Is there any way to use similar functionality to the <html:options> to display the label for a value as text (not as a select list) from a Collection of LabelValue beans. Hope that makes sense and thanks for taking the time to answer.
Rob -----Original Message----- From: Keith Bacon [mailto:[EMAIL PROTECTED]] Sent: Thursday, January 24, 2002 3:53 AM To: Struts Users Mailing List; [EMAIL PROTECTED] Subject: Re: way to use <bean:write> with label value beans Hi Rob, struts handles this for you in it's usual brilliant style! in jsp====================================================================== <html:select name="linkListForm" property="selectedLinkSelectionOption" > <html:options collection="linkSelectionOptions" property="option" labelProperty="label" /> </html:select> ============================================ So your formBean methods get/set the values as on your database. Struts shows the labels. My LinkSelectionOptions is a collection of LinkSelectionOption objects. The LinkSelectionOption class hast get/setLabel & get/set option methods. The label is what the user sees, the option is what is passed to/from the business logic. Hope this is the answer you want, ask for more detail if req. Keith. --- Rob Parker <[EMAIL PROTECTED]> wrote: > This may be a little complicated to explain. Here is a some background info. > I have a page that shows a list of clients (in an html table, not a form) > for a user and a form that lets the user either edit information for and > existing client (by selecting that client from the list) or add a new > client. A lot of the values for the client are populated via <html:options> > select lists using java.util.Collection classes containing LabelValue beans > that I pass in with the request. When I store the user's input in my > database, I store the "value" portion of the LabelValue bean. For example, > the value portion of the LabelValue bean for client status of "New" is "1", > which I store in the database as the integer 1. > > The issue that I am having is when I pull the client information back from > the database to make the list of clients for the user to select from, I pull > back the integer 1 instead of the String "New" for client status. Is there > any easy way to pull the corresponding label for 1 from the Collection that > I pass in with the request so that I can display the label instead of the > Value - sort of like a <bean:write> that selects a label from a Collection > on LabelValue beans for a specific value? It would be much nicer to do that > than to add fields to my form to hold the text representation of the > currently selected option. Hope this makes sense. Thanks, > > Rob > > > -- > To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]> > For additional commands, e-mail: <mailto:[EMAIL PROTECTED]> > __________________________________________________ Do You Yahoo!? Great stuff seeking new owners in Yahoo! Auctions! http://auctions.yahoo.com -- To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]> For additional commands, e-mail: <mailto:[EMAIL PROTECTED]> -- To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]> For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>

