I knew it was a stupid problem ...

On the official site (installation :
http://jakarta.apache.org/struts/doc-1.0.2/installation.html), you have :
<@ taglib uri="/WEB-INF/struts-logic.tld" prefix="struts-logic" %>

and on the same site (documentation :
http://jakarta.apache.org/struts/doc-1.0.2/struts-logic.html#iterate), you
have as example :
<logic:iterate id="element" name="myhashtable">

The solution seemed to be so difficult to find that I have not looked at the
top of my JSP page to be sure the prefix was the same ...

Finally, the solution is

<logic:iterate name="memberBeans" id="memberBean">
<bean:write name="memberBean" property="lastName"/>
</logic:iterate>


Pierre

-----Original Message-----
From: Nicolas De Loof [mailto:[EMAIL PROTECTED]]
Sent: Wednesday, 15 May, 2002 13:32
To: Struts Users Mailing List
Subject: Re: Problem with iterate tag


The Action that forwards to your JSP has to put this bean in "request" or
"session" scope.

You say you get your member list by putting
 " <%= request.getAttribute("memberBeans")%> "
in your JSP it looks ok. Is your "memberBeans" class a Collection ?

Did you include <%@ taglib uri="/WEB-INF/struts-logic.tld" prefix="logic" %>
in jour JSP ?

If not, "<logic:iterate ..." tag will be copied as is in the HTML response
(you can do a "view source" in your browser).

>
> It doesn't work, neither with <logic:iterate name="memberBeans"
> id="memberBean">
> Then, my next "basic" question is : must I put something in the JSP page,
> before the "iterate" tag, to have the "memberBeans" object in the "scope"
?
>
> Pierre
>
> -----Original Message-----
> From: Nicolas De Loof [mailto:[EMAIL PROTECTED]]
> Sent: Wednesday, 15 May, 2002 11:27
> To: Struts Users Mailing List
> Subject: Re: Problem with iterate tag
>
>
> I think you just have to use:
>
> <logic:iterate collection="memberBeans" id="memberBean">
>
>
> So iteratetag will look into scopes for a "memberBeans" object that should
> be a Collection.
>
> What you do is tell iterate tag to look for a Collection named ...
> the result of "request.getAttribute("memberBeans").toString()", that is
the
> datas of the list off members, but not the Collection name !
>
> Nico
>
> > <logic:iterate collection="<%= request.getAttribute("memberBeans")%>"
> > id="memberBean">
> > <tr>
> > <td class="odd"><bean:write name="memberBean" property="LastName"/></td>
> > </tr>
> > </logic:iterate>
> >
> > But nothing appears.
> > To be sure my collection is not empty, I've tried this instruction in my
> JSP
> > page :
> >
> > <%= request.getAttribute("memberBeans")%>
> >
> > and I've saw the 20 memberBean, via the method "toString" defined in the
> > MemberBean class
> >
> > I suppose it's really simple, and I'm searching for some days.
> > Thank you for your help.
> >
> > Pierre
> >
> > --
> > 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]>


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

Reply via email to