Right now, when using <c:forEach> tag on a CDK template.xml, you will have a "for" loop in Java code. There is no way to do simple logic in the template like knowing your current index inside the loop, etc...
An idea would be to support the varStatus attribute from the original <c:forEach>. This attribute maps to the name of a bean which contains util methods and evolve at each iteration of the loop.
Here is a sample:
Would generate something like:
The javadoc of the original LoopTagStatus from JSTL is here. Our LoopTagStatus would have the method and one more : the next() method. This one would increment the current index of the LoopTagStatus in order to be updated for the next iteration.
We could also add any other usefull methods to this bean.