How to access c:forEach index from the tag
843836Apr 5 2004 — edited Apr 5 2005
I have a custom tag that alternates color of the row in the results tables based on the
index of the collection that I am displaying. If the row is odd it is shown as gray, if it is even it is white.
This is of course css style driven.
I am nesting it in the logic:iterate tag because this tag exposes the current index to the nested tags,
so I can easily calculate modulo 2 and detrmine if it is even or odd.
Does anyone know how to implement the same logic with JSTL 1.0 c:forEach tag.
I could not find any public or protected methods that gives me the current index. If anyone has a very concrete solution, or even a complete tag that I could re-use please let me know.
Best regards,
Edmon Begoli