JSTL: another for each and status
<%@ taglib prefix="c" uri="http://java.sun.com/jstl/core" %> <% synchronized (pageContext) { String[] names = {"Joe", "Rosy", "Petter", "Rob"}; pageContext.setAttribute("names", names, PageContext.PAGE_SCOPE); } %> <html> <head> <title>forEach and status</title> </head> <body> The forEach tag exposes a scoped variable called 'count', which is the position of the current element within the collection. <br /> <c:forEach var="currentName" items="${pageScope.names}" varStatus="status"> Family member #<c:out value="${status.count}" /> is <c:out value="${currentName}" /> <br /> </c:forEach> </body> </html>