Just make a getter in your form bean that does that looks up 'status' in the
collection that your form bean is supplying to the <html:options> tag and
return the display value.

Then use <bean:write> to access that attribute of your form bean.

    Erik

----- Original Message -----
From: "Matt Raible" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Wednesday, September 12, 2001 10:48 AM
Subject: Getting the value of a "selected" option into bean:write


> I have the following code to display a drop-down list:
>
> <strutshtml:select property="status" styleClass="selectNormal">
> <strutshtml:options collection="status" property="key"
> labelProperty="value"/>
> </strutshtml:select>
>
> I would like to display the labelProperty to the user after they've used
this
> drop-down for a search criteria.  So in a formbean, I have a status
> getter/setter and use the following code to write it out.
>
> <strutsbean:write name="formbean" property="status" />
>
> However, what I really want to display is the labelProperty, rather than
the
> value.
>
> Any ideas?  I know I could use javascript to populate a hidden field (with
the
> selected.text) when they submit it - but I want to use this same logic to
> display a read-only view of a page.  My read only page will display plain
HTML
> text instead of select fields, so I need to to display the value (rather
than
> the key).  Our UI Standards do not allow us to use the "disabled"
attribute on
> input fields to accomplish this.
>
> Thanks,
>
> Matt
>
> __________________________________________________
> Do You Yahoo!?
> Get email alerts & NEW webcam video instant messaging with Yahoo!
Messenger
> http://im.yahoo.com
>

Reply via email to