Very cool. Thanks. -----Original Message----- From: Pavel Kolesnikov [mailto:[EMAIL PROTECTED]] Sent: Wednesday, October 09, 2002 4:19 PM To: Struts Users Mailing List Subject: Re: ArrayList in Options
On Wed, 9 Oct 2002, Cohan, Sean wrote: > I'll have an ArrayList of beans in my ActionClass. Can I set the ArrayList > in the html:options collection property? Yes. > The doc says the collection > attribute is interpreted as the name of a JSP bean, in some scope. ??? > > If I can do this, how do I expose this ArrayList to the jsp page and refer > to it in the jsp page? Let's suppose beans in your collection have methods getId() and getName(). Then your action class should contain somthing like this: // expose your array list to the request scope request.setAttribute ("blah", yourArrayList); Your JSP (forwarded from action class mentioned above): <%-- render your select-box using collection from your action --%> <html:options collection="blah" property="id" labelProperty="Name" /> See http://jakarta.apache.org/struts/struts-html.html#options Pavel -- To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]> For additional commands, e-mail: <mailto:[EMAIL PROTECTED]> -- To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]> For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>