I have trouble applying this JSTL counter method to my specific case. Maybe there is another better way.
I have this table example:
I have an outer loop, so the c:if conditions gets checked multiple times! And then there are these extra rows I want to add if condition is true:
<c:forEach>
<tr...>
...
</tr>
<c:if test="$("something true here")>
<c:forEach var="entry" items="${entries}">
<tr class="row {CHANGE_THIS!}">
...
</tr>
</c:forEach>
</c:if>
</c:forEach>
I want to be able to change the "CHANGE_THIS" class each time I enter back inside the if clause from the outer loop. So each entry inside the loop still gets same tr class values, but when I come back to if clause again, it would only then change the class name: "CHANGE_THIS".
Like so:
1st forEach loop run:
<tr class="row row1">
<tr class="row row1">
<tr class="row row1">
2nd forEach loop run:
<tr class="row row2">
<tr class="row row2">
<tr class="row row2">
JSTL counter would make these entries which I don't want
<tr class="row row1">
<tr class="row row2">
<tr class="row row3">
Also another problem for me is that JSTL counter is based on some size, I would want to have the increase number functionality without a limit. Is there any other way to achieve these entries with increasing number and how could I create new entries of class names row + (number)?