Java Mailing List Archive

http://www.junlu.com/

Home » Home (12/2007) » Struts 2 »

[S2] Use struts tags to run two loops over each 5 products in a collection?

Neil Aggarwal

2007-07-30


Hello:

I have a collection of products.

I can iterate over them using this code in
a jsp file:

<s:iterator value="currentProducts">
// Do something
</s:iterator>

But, what I want to do is create a table
where I loop over each set of 5 products
twice before moving to the next row in
the table.

For example, if I have 8 products, I want
to visit them in this way:

P1  P2  P3  P4  P5
P1  P2  P3  P4  P5
P6  P7  P8
P6  P7  P8

The reason I want to do this is to be able
to output the images in the first pass and
then the product data in the second.

Is there a way to do this using struts tags?

Thanks,
 Neil

--
Neil Aggarwal, (832)245-7314, www.JAMMConsulting.com
FREE! Eliminate junk email and reclaim your inbox.
Visit http://www.spammilter.com for details.


---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@(protected)
For additional commands, e-mail: user-help@(protected)

©2008 junlu.com - Jax Systems, LLC, U.S.A.