You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Otávio Augusto <ot...@bol.com.br> on 2003/12/29 04:58:11 UTC

Testing iterator quantity

Is there a way to know how many times i've iterated over a collection, using struts tags ? for instance: i have an iterator with 100 elements. I want to put each 10 elements in a different row of a table. Does anybody have an idea?

thanks

Otávio Augusto

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


RE: Testing iterator quantity

Posted by Robert Taylor <rt...@mulework.com>.
Using JSTL tags and assuming you have a collection of elements named
"elements" in some scope:

<table ...>
<c:forEach var="element" items="${elements}" varStatus="status">
<c:if test="${(status.index % 10 == 0) && !status.first}"></tr></c:if><c:if
test="${status.index % 10 == 0}"><tr></c:if>
<td><!-- put data here --></td>
<c:if test="${status.last}"></tr></c:if>
</c:forEach>
</table>

robert

> -----Original Message-----
> From: Otávio Augusto [mailto:otavio.augusto@bol.com.br]
> Sent: Sunday, December 28, 2003 10:58 PM
> To: struts-user@jakarta.apache.org
> Subject: Testing iterator quantity
>
>
> Is there a way to know how many times i've iterated over a
> collection, using struts tags ? for instance: i have an iterator
> with 100 elements. I want to put each 10 elements in a different
> row of a table. Does anybody have an idea?
>
> thanks
>
> Otávio Augusto
>
> ---------------------------------------------------------------------
> 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