Hi, Josef:
The way I handle it is to have three properties in my action form:
1. priority is the value that will be set in action form when the html for
is submitted.
2. priorityIds is the list of possible values that will be submitted for the
"priority".
3. priorityLabels is the list of Strings that appear in the select.
<struts_html:select name="JobForm" property="priority">
<struts_html:options name="JobForm"
property="priorityIds"
labelName="JobForm"
labelProperty="priorityLabels"/>
</struts_html:select>
Hope this helps.
Chris
-----Original Message-----
From: josef richberg [mailto:[EMAIL PROTECTED]]
Sent: Tuesday, March 26, 2002 10:34 AM
To: Struts Users Mailing List
Subject: Re: returning the selected value from an <html:select>
That I understand. What I don't understand is how to
do that. How can I reference the value chosen in the
select? The id is tied to the bean.
--josef
--- Jim Crossley <[EMAIL PROTECTED]> wrote:
> In your formbean, you need to distinguish between
> the value selected
> and the values able to be selected. You've
> accounted for the latter.
> You need another method to account for the former.
> The property
> referred to in your bean:define (returning a
> Collection) should not be
> the same property referred to in your html:select
> that returns a
> String.
>
> -- Jim
>
> josef richberg <[EMAIL PROTECTED]> writes:
>
> > I have the following code snippet:
> > <bean:define id="vendornames" name="ProdAddForm"
> > property="vname"
> > type="java.util.Collection"/>
> >
> > then below
> > <html:select property="vname">
> > <html:options collection="vendornames"
> > property="value" labelProperty="label"/>
> > </html:select>
> >
> > I have a getter method in my Action form:
> > public Collection getVname(){
> > return new DBAccess().getVendorNames();
> > }
> >
> > The problem is if I try to set the result of the
> > selection via this method in the action form:
> > public void setVname(String value){
> > xxxxxx
> > }
> >
> > it errors with: No getter method for property
> vname of
> > bean ProdAddForm
> > How do I retrieve the lone value of the select?
> > --josef
> >
> >
> > __________________________________________________
> > Do You Yahoo!?
> > Yahoo! Movies - coverage of the 74th Academy
> Awards(r)
> > http://movies.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]>
>
__________________________________________________
Do You Yahoo!?
Yahoo! Movies - coverage of the 74th Academy Awards(r)
http://movies.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]>