cocoon-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Mark Lundquist ...@wrinkledog.com>
Subject Re: Jxtemplate forEach Variables
Date Wed, 04 Aug 2004 18:21:14 GMT

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



Mime
View raw message