I invoke the “addObject” of a ModelAndView like so: modelAndView.addObject("userNames", userNames); The second argument is an ArrayList of strings. How can I iterate over this list in a JSP page?
This is what I have, but it doesn’t seem to work:
<select id="users">
<c:forEach var="userName" items="${userNames}">
<option>${userName}<option/>
</c:forEach>
</select>
Do I need to add a tag import to be able to use elements in tag c?
Have you tried:
The c:forEach tag is in the core JSTL library. If you don’t already, you’ll also need the jstl.jar in your build path.