I need to carry a variable counter in an html using JSTL because the JSTL uses a Foreach instead of a for (int i ..)
I tried with: Da error
<c:set var="i" value="-1"/>
<c:forEach items="${finalmente}" var="dato">
<c:set var="i" value="${i=i+1}"/>
<c:out value="${i}"/>
</c:forEach>
Paint literally "i ++"
<c:set var="i" value="-1"/>
<c:forEach items="${finalmente}" var="dato">
<c:set var="i" value="i++"/>
<c:out value="${i}"/>
</c:forEach>
It does not do anything:
<fmt:parseNumber var = "id" type = "number" value = "-1" />
<c:forEach items="${finalmente}" var="dato">
<fmt:parseNumber var = "id" type = "number" value = ${id+1} />
<c:out value="${id}"/>
</c:forEach>
I need some way to keep an accountant. I also have the option of going through Spring MVC the Array "finally" without having to use it, but I do not know how to do it with Spring
The Array sent them to view with:
vista.addObject("finalmente", ArrayOrdenado);
Any of the 2 options is worth me: Keep a counter with JSTL or go through "finally" with a for (int i) in the html.
Thanks