The "collection" attribute requires that the collection exists in some scope. It
seems that there isn't a way to use a collection straight from the form bean.
So, if my collection is in the local form I define it in a bean:define tag.
Something like:
<sbean:define id="numbers" name="orderForm" property="numbers"/>
(orderForm.getNumbers() returns the collection of LabelValueBeans)
Then your html:options tag should work as you have written it.
----- Original Message -----
From: "Kuehnberger" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Thursday, October 18, 2001 2:44 AM
Subject: Options tag
> Hi,
>
> on my webpage a got a form linked to an 'orderForm' bean.
> In that bean a got an arraylist 'numbers' filled with values (with
> LabelValueBean).
> I thought I have to use the options tag in the following way:
>
> <html:form action="/order">
> <html:select property="number">
> <html:options collection="numbers" property="value"
> labelProperty="label"/>
> </html:select>
> </html:form>
>
> but when I try it I get a:
>
> javax.servlet.jsp.JspException: Cannot find bean under name numbers
> at
> org.apache.struts.taglib.html.OptionsTag.getIterator(OptionsTag.java:343)
>
> at
> org.apache.struts.taglib.html.OptionsTag.doEndTag(OptionsTag.java:194)
>
> I found a workaround in adding the following:
> <jsp:useBean id="orderForm" scope="session" class="OrderForm" />
>
> <% pageContext.setAttribute("numbers", orderForm.getNumbers(),
> pageContext.SESSION_SCOPE);%>
>
> can someone tell me how do I have to use the select and options tag
> correctly ?
>