It's much better to stick your info in a collection so you can use the
<html:options> tag!!
Dave
"Galbreath, Mark" <[EMAIL PROTECTED]> on 04/17/2002
08:44:31 AM
Please respond to "Struts Users Mailing List"
<[EMAIL PROTECTED]>
To: "'Struts Users Mailing List'"
<[EMAIL PROTECTED]>
cc: (bcc: David Hay/Lex/Lexmark)
Subject: RE: [Q] select : Option - Urgent Help required.
I'm not totally clear on your Region or bean attributes, but the idea is
something like:
// bean property to set/get
<html:select property="selectedRegion">
// List to iterate, type is fully-qualified path,
// id is arbitrary, property is List element
<logic:iterate name="<%= regions %>"
property="id"
type="Region"
id="region">
// set the option value
<html:option value="<%= region.getId() %>">
// set the option label
<bean:write name="region" property="String" />
</html:option>
</logic:iterate>
</html:select>
Mark
-----Original Message-----
From: Sanjay Choudhary [mailto:[EMAIL PROTECTED]]
Sent: Wednesday, April 17, 2002 8:23 AM
> Need help with select option
>
> I have a formBean called RegionForm
>
> RegionForm contain attribute selectedregion:String
> and
> regions:ArrayList.
>
> regions:ArrayList is collection of object of class
> Region.
>
> Region class has attributes id and String.
>
> I wish to display on the form select option in the
> drop down box and populate it with all the items in
> the regions:Arraylist and display id attribute.
> Selected value should populate selectedregion:String
> in RegionForm.
>
> I tried nested:select and html:select but no
> success.
--
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]>