I have a value set in the request
object like the following,
String[] categoriesList=null;
categoriesList = engine.getCategoryNamesArray();
request.setAttribute("categoriesList", categoriesList );
and this is how I iterate in jsp page
<% if(request.getAttribute("categoriesList") != null) { %>
<c:forEach var="categoryName" items="${categoriesList}">
<li><a onclick="getCategoryIndex()" href="#">${categoryName}</a></li>
</c:forEach>
<% }%>
How do I get index of each element and pass it to JavaScript function onclick="getCategoryIndex()"
.