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>&nbsp;&nbsp;
============================================
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]>

Reply via email to