In this example, I have an ActionForm ClaimsQCForm.  On that form I have an
arraylist named stateBeanList.

<snip>
protected java.util.ArrayList stateBeanList = null;

...
        /**
         * Gets the stateBeanList
         * @return Returns a java.util.ArrayList
         */
        public java.util.ArrayList getStateBeanList() {
                return stateBeanList;
        }
        /**
         * Sets the stateBeanList
         * @param stateBeanList The stateBeanList to set
         */
        public void setStateBeanList(java.util.ArrayList stateBeanList) {
                this.stateBeanList = stateBeanList;
        }
<snip>

The stateBeanList is an arrayList of a JavaBean stateBean which is basically
the getters and setters associated with a database table of states (US and
Canada) which I loaded with my action object servlet. Two of the columns in
this table are stateAbbreviation and stateName.  I am allowing the user to
select the state name and returning the state abbreviation to another bean
defined in my actionForm ClaimsQCForm cib.installationState.



Here is the JSP code relating to this

<bean:define id="stateList" name="ClaimsQCForm" property="stateBeanList"  />

<html:select name="ClaimsQCForm" property="cib.installationState" size="1"
styleClass="larger">
  <html:option value=" ">
    <bean:message key="option.selectState"/>
  </html:option>

  <html:options collection="stateList" 
   property="stateAbbreviation"
   labelProperty="stateName" />
</html:select>

The bean:message section is a text messge that say "Please Select a State"
fyi

I hope this helps

Steve Gibson
 
336-217-6394

-----Original Message-----
From: Ashish Kulkarni [mailto:[EMAIL PROTECTED] 
Sent: Tuesday, October 26, 2004 10:22 AM
To: [EMAIL PROTECTED]
Subject: using dropdown box <html:options example

Hi
Can some on provide a example of using <html:options
in jsp, 
how to define the in struts-config.xml file, how to
populate the data in Action class and then display it
on jsp page,
Also how to retain this data in request for other
request, 
For example , suppose the user hits enter to submit
the data Action class which process the data, and if
there is any error, display back the jsp with the
error message, and all the values in dropdown box with
the value selected by user selected in option
I have seen the examples provided by struts, but it is
not clear how to use it with Action class
Ashish



                
__________________________________
Do you Yahoo!?
Yahoo! Mail Address AutoComplete - You start. We finish.
http://promotions.yahoo.com/new_mail 

---------------------------------------------------------------------
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