Vijaya S wrote the following on 5/9/2005 1:40 AM:
You can create a bean using LabelValueBean in which the label will be male,
female and the value will be 1, 2.  In your jsp you do the following
<html:select property="form-property-name" >
        <html:optionsCollection name="bean-name" value="value" label="label"
/>
</html:select>

On submit, your form-property-name will have the values 1 or 2 depending on
the selection.

Yes, but this doesn't solve his problem unless you make sure the obove bean is really a Map where you can look up the name based on the value. This is one option, but not always possible if you are working with a collection of beans you get from backend.


I usually opt to use a hidden param and use javascript to set it...

<select onChange="this.form.hiddenName.value=this.options[this.selectedIndex].text">
...
</select>


<input tyep="hidden" name="hiddenName"/>

Tim's idea of using a compound value is also good where you parse it out in the Action.

--
Rick

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Reply via email to