Here's where I got my collection.

<jsp:useBean id="stockbean" class="chemical.ChStocknoBean" scope="session"/>
<jsp:useBean id="code1mst" class="codemst.Code1mstBean" scope="session"/>
<jsp:useBean id="code2mst" class="codemst.Code2mstBean" scope="session"/>

<%
String stockno = request.getParameter("chemical.stockno");
String username = request.getParameter("chemical.approved_by");
stockbean.chkStockno(stockno);

Collection code1data = code1mst.getDatabyFieldName("CHEMICAL CLASS");
Collection code2data = code2mst.getDatabyFieldName("CHEMICAL STORE");

%>



Ray Madigan wrote:

> How did you get the collection in your jsp page.  Did you create it there,
> or did you bring it in from your ActionForm.
>
> If you would create a get/set on your FormBean and place it in the FormBean
> in your Action object, then you can get it from the form bean with the
> collection attribute in select.
>
> If you want I can outline the code to do this.
>
> Thanks
> Ray Madigan
> -----Original Message-----
> From: Buics [mailto:[EMAIL PROTECTED]
> Sent: Saturday, February 22, 2003 8:04 PM
> To: Struts Users Mailing List
> Subject: Re: html select problem, help me please
>
> It gives me no choice Ray, I'll have to do it in the dirty way.
> Well first timer, so thats it.
>
> <html:select property="chemical.classification" >
>         <%
>   Iterator i = code1data.iterator();
>   Hashtable data = new Hashtable();
>   while (i.hasNext())
>   {
>   data = (Hashtable) i.next();
>   String cd = (String) data.get("cd");
>   String descrip =(String) data.get("descrip");
>   out.println("<option value=\"" + cd + "\">" + descrip );
>   }
>          out.println("</option>");
>      %>
>  </html:select>
>
> Thank you for your time Ray.
>
> --buics
>
> Ray Madigan wrote:
>
> > This has confused me too - I think that <html:options use of collection
> > is different from <logic:iterate use of collection
> >
> > in the <html:options case it is a string that names the attribute that
> > holds the collection.
> >
> > in the <logic:iterate case collection is the real class that you want to
> > iterate.  If you want to use <html:options you should put the collection
> > into a session or request attribute.
> >
> > -----Original Message-----
> > From: Buics [mailto:[EMAIL PROTECTED]
> > Sent: Friday, February 21, 2003 7:08 PM
> > To: Struts Users Mailing List
> > Subject: html select problem, help me please
> >
> > I have a collection named code1data, in logic:iterate it works fine, but
> > when I
> > apply this to html:select it goes wrong.
> > Anybody could help me in html:select tag.
> >
> > here's my script ..
> >
> > <TABLE><tbody>
> > <logic:iterate id="mydata" collection="<%=code1data %>">
> >     <tr>
> >       <td >&nbsp;</td>
> >       <td>
> >        &nbsp;<bean:write name="mydata" property="cd"/>
> >       </td>
> >       <td >
> >        &nbsp;<bean:write name="mydata" property="descrip"/>
> >       </td>
> >      </tr>
> >  </logic:iterate>
> >  </tbody>
> > </TABLE>
> >
> > <html:select property="classification" size="1">
> >     <html:options collection="<%=code1data %>"  property="cd"
> > labelProperty="descrip"/>
> > </html:select>
> >
> > --
> > It's good to be slow and steady; but it's better to be fast and reliable.
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: [EMAIL PROTECTED]
> > For additional commands, e-mail: [EMAIL PROTECTED]
>
> --
> It's good to be slow and steady; but it's better to be fast and reliable.
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]

--
It's good to be slow and steady; but it's better to be fast and reliable.


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to