This works for me:
<html:select name="userForm" property="roleName">
<html:option value="-1">-- Select a Role -- </html:option>
<html:options collection="Roles" property="name" />
</html:select>
where the userForm.getRoleName() method will return a value that matches
with one of the values returned by the getName() method of the objects
stored in the Roles collection.
HTH
-----Original Message-----
From: DHarty [mailto:[EMAIL PROTECTED]]
Sent: Thursday, July 19, 2001 6:31 AM
To: [EMAIL PROTECTED]
Subject: RE: html:select/options
Good question, and what if you want to get the value from a bean?
Is value='<@=bean.getsomthing()%>' the only way?
> -----Original Message-----
> From: Pham Thanh Quan [mailto:[EMAIL PROTECTED]]
> Sent: Wednesday, July 18, 2001 9:23 PM
> To: [EMAIL PROTECTED]
> Subject: Re: html:select/options
>
>
> But how to keep the choice that user chose in the last time he submitted
>
> ----- Original Message -----
> From: Joe Clark <[EMAIL PROTECTED]>
> Sent: Wednesday, July 18, 2001 11:12 PM
> Subject: RE: html:select/options
>
>
> > Use the 'value' attribute to make the selection. For example assume you
> > have a dropdown of countries and one entry is 'United States' the code
> > below would select 'United States'.
> > <html:select
> > property="country" value="United States">
> > ...
> > </html:select>
> >
> > -----Original Message-----
> > From: [EMAIL PROTECTED] at INTERNET
> > [mailto:IMCEACCMAIL-struts-user+40jakarta+2Eapache+2Eorg+20at+20INTERNET
> > @alltel.com]
> > Sent: Wednesday, July 18, 2001 10:38 AM
> > To: Clark, Joe; [EMAIL PROTECTED] at INTERNET
> > Subject: html:select/options
> >
> >
> > Is there a way to dictate which "option" in a collection is initially
> > set
> > as
> > "selected" when the page is rendered?
> > ex
> > <html:options collection="Roles" property="name" /
> >
> > For example, I have a collection of projects that are rendered by the
> > <html:options tag. I also have some java script which updates a
> > project
> > description box when the selection is changed. The problem is
> > when the page
> > is first rendered, the two don't always match up. I initialize the
> > description box to the first item in the collection, but the
> > select doesn't
> > always choose the first item.
> >
> > Thanks
> > D
> >
>