Title: Does anyone have a example to generate a drop down list?
 
IN FORM:
 
   // Get all xxx Values for DropDown.
   xxxDropDown[] results = profileSession.getxxxValues();   
   
   // Create the arrays for the labels and values.
   xxxLabels = new ArrayList();
   xxxValues = new ArrayList();
   
   // For each value returned...
   for (int i = 0; i < results.length; i ++)
   {
    // Add a label and a value to the corresponding list.
    xxxLabels.add(new String(results[i].getLabel()));
    xxxValues.add(new String(results[i].getValue()));
   }
 
 
IN JSP:
 
  <html:select property="selectedValue">
       <html:options property="xxxValues" labelProperty="xxxLabels"/>
  </html:select>
 
Make sure to define the xxxLabels and xxxValues as type ArrayList and import the class.
 
Hope this helps!  :-)
----- Original Message -----
From: Joyce Tang
Sent: Friday, May 18, 2001 10:28 AM
Subject: Does anyone have a example to generate a drop down list?

Assuming I have a object method returning a list of values.  Does anyone have a example to generate a drop down list?

Reply via email to