You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by "Pal, Gaurav" <Ga...@arbitron.com> on 2001/06/15 16:18:19 UTC

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

Re: select options doesn't work

Posted by Linnea Ahlbeck <li...@appium.com>.
Hi!

Try to change your property for the option to a boolean!!

private String strValue;

private boolean value;

/Linnéa
----- Original Message -----
From: "Pal, Gaurav" <Ga...@arbitron.com>
To: <st...@jakarta.apache.org>
Sent: Friday, June 15, 2001 4:18 PM
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;
>    }
> }
>