use varStatus to get the index c:forEach varStatus properties
<c:forEach var="categoryName" items="${categoriesList}" varStatus="loop">
<li><a onclick="getCategoryIndex(${loop.index})" href="#">${categoryName}</a></li>
</c:forEach>
More Related Contents:
- Is there a way to access an iteration-counter in Java’s for-each loop?
- How to iterate an ArrayList inside a HashMap using JSTL?
- EL access a map value by Integer key
- ConcurrentModificationException when adding inside a foreach loop in ArrayList [duplicate]
- Java for loop syntax: “for (T obj : objects)”
- How to do if-else in Thymeleaf?
- Initializing an array in Java using the ‘advanced’ for each loop [duplicate]
- Last iteration of enhanced for loop in java
- Use with HashMap [duplicate]
- Access Enum value using EL with JSTL
- IntelliJ and JSP/JSTL cannot resolve taglib for JSTL in tomcat7 [duplicate]
- Java 8 forEach with index [duplicate]
- How to resolve : Can not find the tag library descriptor for “http://java.sun.com/jsp/jstl/core” [duplicate]
- The ultimate Java version table (J2EE, Java EE, Servlet, JSP, JSTL)
- I can pass a variable from a JSP scriptlet to JSTL but not from JSTL to a JSP scriptlet without an error
- Where can I download JSTL jar [closed]
- How can I print error stack trace in JSP page?
- How to pass parameter to jsp:include via c:set? What are the scopes of the variables in JSP?
- What does the colon (:) operator do?
- JSP : JSTL’s tag
- why is the enhanced for loop more efficient than the normal for loop
- Iterating through a List Object in JSP
- How do I make a Java ResultSet available in my jsp? [duplicate]
- Using for loop inside of a JSP
- JSTL iterate over list of objects
- java.lang.NumberFormatException: For input string in JSP Page
- Retrieving cookie and array values in JSTL tags
- Can not find the tag library descriptor for “http://java.sun.com/jsp/jstl/core”
- Code after if block inside a for loop doesn’t work
- How should I use servlets and Ajax?