<jsp:useBean id="agencyIds" type="java.util.Vector" scope="page" />

create a scripting variable "agencyIds" and a page scope bean "agencyIds". This 
created vector is empty.

<%  agencyIds= MyUtils.getAgencyIds();   %>

chags the object referenced by the scripting variable, but not the page scoped bean.

You should use something like this, assuming populateAgencyIds(List) adds items to an 
existing List :

<% MyUtils.populateAgencyIds(agencyIds); %>

Nico.



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


> hi!
> thanks for the reply.
> doesn't the jsp import statement followed by the usebean ie,
> %@ page import="MyUtils" %>
> <jsp:useBean id="agencyIds" type="java.util.Vector" />
> introduce the agencyIds into page scope.
> also with the example you gave me should
> ><html:select  property="agencyId">
> >        <html:options collection="agencyIds"
> >             label="label"
> >             value="value" />
> ></html:select>
> shouldn't the value of collections be items, since that is the key you used.
> 
> thanks
> cheers
> ajay
> 
> 
> >From: "Nicolas De Loof" <[EMAIL PROTECTED]>
> >Reply-To: "Struts Users Mailing List" <[EMAIL PROTECTED]>
> >To: "Struts Users Mailing List" <[EMAIL PROTECTED]>
> >Subject: Re: URGENT: html:options
> >Date: Tue, 14 Oct 2003 15:11:57 +0200
> >
> >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]
> >
> 
> _________________________________________________________________
> Get less junk mail with 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