You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by "Jouhal, CJ" <cj...@half.com> on 2001/01/03 15:31:20 UTC
Newbie Question on Logic:Iterate Tag
Could someone please give me an example of struts logic iterate tag.
for example if I was to have a bean object called:
<jsp:useBean id="myObj" class="com.mycompany.TestObject"
scope="request"/>
TIA,
CJ
RE: Newbie Question on Logic:Iterate Tag
Posted by Dennis <de...@iswsolutions.com>.
Um....*red-faced* Nevermind. It seems forgetting to identify the logic tag
library is a problem!
Thanks anyway,
Dennis
-----Original Message-----
From: Dennis [mailto:dennis@iswsolutions.com]
Sent: Thursday, January 04, 2001 3:46 PM
To: struts-user@jakarta.apache.org
Subject: RE: Newbie Question on Logic:Iterate Tag
Ted,
In this example (I'm still having problems using the iterate tag), how does
the "row" get put into a context? Where is that bean? According to the tag
docs, id is "The name of a page scope JSP bean that will contain the current
element of the collection on each iteration."
Thanks,
Dennis
-----Original Message-----
From: Ted Husted [mailto:news.ted@husted.com]
Sent: Wednesday, January 03, 2001 8:09 AM
To: Struts List
Subject: Re: Newbie Question on Logic:Iterate Tag
Basically, iterate will run through a collection object that you've
stored in one of the contexts (page, request, session, or application),
using a call like request.SetAttribute("myObj", myObj); You can then do
something like
<logic:iterate id="row" name="myObj">
<li><bean:write name="row" property="myProperty"/></li>
</logic:iterate>
in your JSP. (Assuming that myObj is an array, hashtable, et cetera.)
RE: Newbie Question on Logic:Iterate Tag
Posted by Dennis <de...@iswsolutions.com>.
Ted,
In this example (I'm still having problems using the iterate tag), how does
the "row" get put into a context? Where is that bean? According to the tag
docs, id is "The name of a page scope JSP bean that will contain the current
element of the collection on each iteration."
Thanks,
Dennis
-----Original Message-----
From: Ted Husted [mailto:news.ted@husted.com]
Sent: Wednesday, January 03, 2001 8:09 AM
To: Struts List
Subject: Re: Newbie Question on Logic:Iterate Tag
Basically, iterate will run through a collection object that you've
stored in one of the contexts (page, request, session, or application),
using a call like request.SetAttribute("myObj", myObj); You can then do
something like
<logic:iterate id="row" name="myObj">
<li><bean:write name="row" property="myProperty"/></li>
</logic:iterate>
in your JSP. (Assuming that myObj is an array, hashtable, et cetera.)
Re: Newbie Question on Logic:Iterate Tag
Posted by Ted Husted <ne...@husted.com>.
Basically, iterate will run through a collection object that you've
stored in one of the contexts (page, request, session, or application),
using a call like request.SetAttribute("myObj", myObj); You can then do
something like
<logic:iterate id="row" name="myObj">
<li><bean:write name="row" property="myProperty"/></li>
</logic:iterate>
in your JSP. (Assuming that myObj is an array, hashtable, et cetera.)
The Example application uses the iterate tag in registration.jsp.
For more about the Struts Example application, see
< http://husted.com/about/struts >
The "Stuts with a Fruit Glaze" also uses iterate in the
"fruitSales.jsp".
*********** REPLY SEPARATOR ***********
On 1/3/2001 at 6:31 AM Jouhal, CJ wrote:
Could someone please give me an example of struts logic iterate tag.
for example if I was to have a bean object called:
<jsp:useBean id="myObj" class="com.mycompany.TestObject"
scope="request"/>
TIA,
CJ