collection attribute of <html:options> tag is used to set the name of a bean (in some 
scope) that is a collection of the
items off the select-box.

You need to put your Vector into page or request scope to use this tag:

<%
    request.setAttribute("items", agencyIds);
%>

<html:select  property="agencyId">
       <html:options collection="agencyIds"
            label="label"
            value="value" />
</html:select>

Nico.


----- Original Message ----- 
From: "ajay brar" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Tuesday, October 14, 2003 2:53 PM
Subject: RE: URGENT: html:options


> hi!
>
> >I think your collection needs to implement the List interface (use an
> >ArrayList instead of a vector)
> but a vector implements the List interface, or so says the api
> any other ideas
>
>
>
> >
> >-----Original Message-----
> >From: ajay brar [mailto:[EMAIL PROTECTED]
> >Sent: 14 October 2003 12:45
> >To: [EMAIL PROTECTED]
> >Subject: URGENT: html:options
> >
> >hi!
> >i'm getting a problem with my html:options
> >what i have is a MyUtils class with a method to retrieve a list of agency
> >id's from the database
> >class MyUtils
> >{
> >    //gets agencyIds creates LabelValueBeans and chucks them into a Vector
> >      public static Vector getAgencyIds()
> >}
> >
> >in my jsp page i had
> ><%@ page import="MyUtils" %>
> ><jsp:useBean id="agencyIds" type="java.util.Vector" />
> ><%  agencyIds= MyUtils.getAgencyIds();   %>
> >i then had
> ><html:select  property="agencyId">
> >       <html:options collection="agencyIds" property="value"
> >labelProperty="label" />
> ></html:select>
> >
> >this gave me an error, setCollection(java.lang.String) cannot be applied to
> >java.util.Vector
> >this was a compiler error.
> >
> >i tried doing,
> >changed MyUtils to
> >class MyUtils
> >{
> >    private Vector agencyIds=new Vector();
> >    //gets agencyIds creates LabelValueBeans and chucks them into a Vector
> >      public Vector getAgencyIds()
> >}
> ><%@ page import="MyUtils" %>
> ><jsp:useBean id="foo" type="MyUtils" />
> ><html:select  property="agencyId">
> >       <html:optionsCollection name="foo" property="agencyIds"
> >label="label"
> >value="value" />
> ></html:select>
> >
> >this gave me an error saying it couldn't find bean agencyId in any scope.
> >
> >could someone please help.
> >
> >thanks
> >cheers
> >ajay
> >
> >_________________________________________________________________
> >ninemsn Premium transforms your e-mail with colours, photos and animated
> >text. Click here  http://ninemsn.com.au/premium/landing.asp
> >
> >
> >---------------------------------------------------------------------
> >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]
> >
>
> _________________________________________________________________
> E-mail just got a whole lot better. New ninemsn Premium. Click here
> http://ninemsn.com.au/premium/landing.asp
>
>
> ---------------------------------------------------------------------
> 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