On Aug 4, 2004, at 8:21 AM, Brent Johnson wrote:

When looping in a JXTemplate using jx:forEach I can refer to the
current item as the variable specified in the var attribute. Are
there any other variables I can access in this loop related to the
loop itself? I'd like to be able to test an expression to find out if
I'm at the last item in the loop. Here's an example:

----
List of items:
<jx:forEach items="${location.getContainer()}" var="item">
${item.getName()},
</jx:forEach>
----

Heya, Brent-Bob, dig on this...

<jx:forEach items="${location.getContainer()}" var="item" varStatus="loop">
${item.getName()}
<jx:if test="loop.last != 'true'">,</jx:if>
</jx:forEach>

...or somethin' like that. See http://cocoon.apache.org/2.1/userdocs/flow/jxtemplate.html#forEach

HTH,
~ml


Reply via email to