In your Form bean change your set method to take a string.

   public void setMarketList(String marketList)
   {
   }

You will only get the item the user selected back in your bean, not the
whole list.



-----Original Message-----
From: Kiet Nguyen
To: '[EMAIL PROTECTED]'
Sent: 6/15/2001 11:10 AM
Subject: RE: select options doesn't work

look at the subscription.jsp in the strutsexample.  

-----Original Message-----
From: Pal, Gaurav [mailto:[EMAIL PROTECTED]]
Sent: Friday, June 15, 2001 7:18 AM
To: '[EMAIL PROTECTED]'
Subject: select options doesn't work


Hi,
I have been trying to get the select options tag to work in the html tag
library. I tried to follow the sample code given in the struts-mailing
list.
I keep getting jsp exceptions at
org.apache.struts.taglib.template.InsertTag.doEndTag ...

The code snippets are below...any help is appreciated.
Thanks,
Gaurav

<jsp:useBean id="myBean" scope="request" type="com.xyz.MyForm" />
        <bean:define id="myList" name="myBean" property="marketList"
scope="request" />   
        
       <html:select name="myBean" property="marketList" size="1">
          <html:options collection="myList" property="value"
labelProperty="description" />
       </html:select>


Here is my bean with a Vector consisting of Option objects with value
and
description as the property.


public class MyForm extends ActionForm
{
   private Vector marketList;
   public void setMarketList(Vector marketList)
   {
      // SBgen: Assign variable
      this.marketList = marketList;
   }

   public Vector getMarketList()
   {
      // SBgen: Get variable
      return(marketList);
   }
}

class Option
{
   private String strValue;
   private String strDescription;
   
   public void setValue(String value)
   {
      strValue = value;
   }
   
   public String getValue()
   {
      return strValue;
   }
   
   public void setDescription(String description)
   {
      strDescription = description;
   }
   
   public String getDescription()
   {
      return strDescription;
   }
}   

Reply via email to