Display value in a <c:forEach> loop
I am using Spring MVC 3. From my controller I set value
mav = new ModelAndView();
mav.setViewName("reports");
mav.addObject("ReportList", ReportList);
return mav;
In JSP
<c:forEach var="list" items="${ReportList}">
$(list.name)
</c:forEach>
ReportList has a size of 7. ReportList is a list of Re开发者_JAVA技巧port class having name as instance with proper getters and setters.
When I run it in browser it displays $(list.name)
7 times.
Its not displaying proper names.
These brackets: { }
<c:forEach var="list" items="${ReportList}">
${list.name}
</c:forEach>
It should be ${list.name}
...
You should use the <c:out>
tag to render the value of the name
attribute. #{list.name}
might work as well (replace (
with {
).
精彩评论