You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by ha...@informatiefabriek.nl on 2003/04/09 15:10:34 UTC

Using iterator tag

Hi all,

I'm building an application using struts. But, I have a question about the 
<logic:iterator> tag.

In my Action I put an Vector containing AdvertisementForm objects into the 
session object using:


request.getSession().setAttribute("advertisements", formbeans);

(Of course formbeans is a vector).

Now in my JSP I want to iterate that vector. But I don't know how. This is 
what I already tried, but does not work.

<logic:present name="advertisements">
        <logic:iterate  id="advertisement"    name="advertisements">
                <bean:write name="advertisement"  property="serial"/>
        </logic:iterate>
</logic:present>

Can somebody please help?

Thanks, 

Harm de Laat
Informatiefabriek


---------------------------------------------------------------------
To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: struts-user-help@jakarta.apache.org


Re: Using iterator tag

Posted by ha...@informatiefabriek.nl.
Thanks for your help. 
It turned out to be a bug in my Action. (The same instance got added to 
the vector over and over again).

I also added the type like you suggested!

Grtzz Harm.




"Ian Hunter" <ih...@hunterweb.net> 
04/09/2003 03:20 PM
Please respond to
"Struts Users Mailing List" <st...@jakarta.apache.org>


To
"Struts Users Mailing List" <st...@jakarta.apache.org>
cc

Subject
Re: Using iterator tag






Sounds like you're almost there... you may need to specify what object 
class
the vector contains (see the type attribute of the logic:iterate tag 
below):

<logic:present name="advertisements">
        <logic:iterate  id="advertisement"    name="advertisements"
type="VectorOfWhatType?">
                <bean:write name="advertisement"  property="serial"/>
        </logic:iterate>
</logic:present>


---------------------------------------------------------------------
To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: struts-user-help@jakarta.apache.org




---------------------------------------------------------------------
To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: struts-user-help@jakarta.apache.org


Re: Using iterator tag

Posted by Ian Hunter <ih...@hunterweb.net>.
Sounds like you're almost there... you may need to specify what object class
the vector contains (see the type attribute of the logic:iterate tag below):

<logic:present name="advertisements">
        <logic:iterate  id="advertisement"    name="advertisements"
type="VectorOfWhatType?">
                <bean:write name="advertisement"  property="serial"/>
        </logic:iterate>
</logic:present>


---------------------------------------------------------------------
To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: struts-user-help@jakarta.apache.org