Ciao Michel

Something like should do the job to get the actual index:

<jx:forEach var="item" items="${items}" varStatus="rowStat">
  ${item} : ${rowStat.index}
</jx:forEach>

Where rowStat contains e.g. the actual index of the iteration.

See also http://cocoon.apache.org/2.1/userdocs/flow/jxtemplate.html

Felix

> Hello, 
>
> I'm implemented this loop with jx:
>
> <page xmlns:jx="http://apache.org/cocoon/templates/jx/1.0";>
>               <jx:set var="counter" value="#{-1}"/> 
>               <jx:forEach var="item" items="${list}">
>                 <jx:set var="counter" value="#{1 + $counter}"/>
>                 ${item} : ${counter}<br/>
>               </jx:forEach>
> </page>
>
> function home() {
>       var list = new ArrayList();
>       list.add("test 1");
>       list.add("test 2");
>       list.add("test 3");
>       list.add("test 4");
>       list.add("test 5");
>     cocoon.sendPage("home.page", {list:list});
> }
>
> the output is: 
>
> test 1 : 0.0
> test 2 : 0.0
> test 3 : 0.0
> test 4 : 0.0
> test 5 : 0.0
>
> the increment of the counter is only performed once. In older versions of 
> cocoon this did work, now with version 2.2 I've this problem.
>
> Doe's somesing change? Is there another way to do this?
>
> Tanks for any hints.
>
> Mike 
>
>
> ____________________________________________
> QuickLine WebMail - http://www.QuickLine.com
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>
>   


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to