or

<html:select size="13" property="subject">
        <html:optionsCollection              
                property="myCollection" value="key" labelProperty="label">
        </html:options>
</html:select>

You don't even have to specify value="key" and labelProperty="label" if the bean in your array list has 2 properties "key" and "label" as Hakan said.

Take a look at the doc here: http://jakarta.apache.org/struts/userGuide/struts- html.html#optionsCollection

-H

On Dec 4, 2003, at 6:27 AM, Håkan Fransson wrote:

I'm using the collection attribute instead. The collection is an ArrayList
of individual beans with properties "key" and "label".


<html:select size="13" property="subject">
        <html:options
                collection="<%= CourseCatalogueJSPAttributes.JSPATTRIBUTE_SUBJECT %>"
                property="value" labelProperty="label">
        </html:options>
</html:select>

-----Ursprungligt meddelande-----
Från: Engbers, ir. J.B.O.M. [mailto:[EMAIL PROTECTED]
Skickat: den 4 december 2003 11:45
Till: '[EMAIL PROTECTED]'
Ämne: (bean-)property gets out of scope/session?


I'm fairly new to Struts, java and servlets so maybe it's a stupid question
but I have this problem:


Based on the pattern that is used by Steve Raeburn in his struts-examples, I
start my web-application with a prepareAction in which I declare
ArrayList codering= new ArrayList();
codering.add("NA");
codering.add("NF");
request.setAttribute("codering",codering);


I then forward to
        return mapping.findForward("success");

which redirects to Search.jsp

In Search.jsp I want to use this code:
      <html:select property="landCode" >
          <html:options name="codering" />
        </html:select><BR>

Tomcat however complains:
org.apache.jasper.JasperException: Cannot find bean under name codering

If I replace <html:options> with <html:option>-tags the Search page gives no
problem.


As far as I understand the Struts-architecture, request.setAttribute and
request.getAttribute are complimentory.
In his code-examples, I can't find any directives that could serve to
include the bean (jsp:useBean?)


Maybe I'm overlooking something but who has any thoughts?

Ben Engbers




--------------------------------------------------------------------- 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]



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



Reply via email to