struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Amir Iqbal" <>
Subject Re: Using select tag
Date Tue, 03 Oct 2000 02:52:53 GMT

Its very simple
You can use something like this

<struts:select property="selectedState" size="1" style="font-family: Verdana,
Arial; font-size: 8pt">
     <struts:options property="stateCodes" labelProperty="stateNames"/>

This tag is inside the body of a <struts:from> tag. This tag uses the ActionForm
 bean for getting list of states and state codes.
Your ActionForm bean should have two properties of type Collection (array,
Vector, Lists etc) with names stateCodes, and stateNames.
These properties are used in Options tag to get values and lables for select
A third property selectedState will be used to track the user selection.
I hope this will help. If you need further information let me know


"Gaurav Gehlot" <> on 09/29/2000 06:50:01 AM

Please respond to

 To:      "Struts-User" <>      
 cc:      (bcc: Amir Iqbal/Singapore/Netlife)                 
 Subject: Using select tag                                    

   I want to use the select tag in struts to print out the list of US states
along with their codes.Something like this,

     <select name="states">
     <option value="AZ">Arizona</option>
     <option value="CA">California</option>

     The list of states and their codes is a two dimensional array of strings in
a bean.
     How can i do it in struts framework?


View raw message