use optionsCollection tag

property: name of the collection in the form Bean
label : The property of the bean within the collection which represents the label to be rendered for each option. (ie. Name)
value: The property of the bean within the collection which represents the value to be rendered for each option. (ie ID)



thus:


<html:optionsCollection property="propertyOfFormBeanContainingCollection" label="name" value="id" />





Abhinav (Cognizant) wrote:

That means we are keeping unsafeValues and unsafeLabels separately in our form-bean. 
(Though they are related -- i think so)
What if these two are kept encapsulated in an object.

-----Original Message-----
From: Kandi Potter [mailto:[EMAIL PROTECTED]
Sent: Tuesday, May 27, 2003 9:06 PM
To: Struts Users Mailing List
Subject: RE: html:select / html:options


I used the following with vectors of unsafeValues and unsafeLabels in my incidentForm bean.




<html:select  name="incidentForm"  property="selectedUnsafe"  >
   <html:option value="">&nbsp</html:option>
   <html:options name="incidentForm" property="unsafeValues"  labelName="incidentForm"              
                                           labelProperty="unsafeLabels" />
</html:select></TD>





-----Original Message-----
From: Abhinav (Cognizant) [mailto:[EMAIL PROTECTED]
Sent: Tuesday, May 27, 2003 11:20 AM
To: Struts Users Mailing List
Subject: html:select / html:options


I have a vector of Objects of a class whose attributes are ID and Name. This vector is set in the form bean.

I want to display that vector as a select/options field.
ID part will form the value and Name the displayable option.

How can this be done.

Thanx a lot.


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





------------------------------------------------------------------------

****** Message from InterScan E-Mail VirusWall NT ******

** No virus found in attached file noname.htm

No Virus detected in the attached file(s).
*****************     End of message     ***************




------------------------------------------------------------------------

This e-mail and any files transmitted with it are for the sole use of the intended recipient(s) and may contain confidential and privileged information. If you are not the intended recipient, please contact the sender by reply e-mail and destroy all copies of the original message. Any unauthorised review, use, disclosure, dissemination, forwarding, printing or copying of this email or any action taken in reliance on this e-mail is strictly prohibited and may be unlawful.

Visit us at http://www.cognizant.com



------------------------------------------------------------------------

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




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



Reply via email to