1

Looking for a better way to display count in Spring MVC. You can see from my code below that in my controller I get a list of records and in my request scope I have the list under the name "names" and then I do a size of the list and I have it under a request scope called "count"

<h1>List of Names Found (<c:out value="${requestScope.count}"/>):</h1>

<c:forEach items="${requestScope.names}" var="id">
    <c:out value="${id.message}"/><br>
</c:forEach>

I would think I would have someway in my JSP to just get the count from the list? can this be done?

SJS
  • 5,607
  • 19
  • 78
  • 105

1 Answers1

5
${fn:length(requestScope.names)}

gets you the size of a list, you will need this

<%@ taglib prefix="fn" uri="http://java.sun.com/jsp/jstl/functions" %>
NimChimpsky
  • 46,453
  • 60
  • 198
  • 311