Archive

Posts Tagged ‘JSP’

Handling Empty Lists In JSTL

July 28th, 2009 No comments
<c:choose>
  <c:when test="${(myList!=null) && (not empty myList) }">
    <c:forEach var="myListItem" items="${myList}">
    <!-- Loop through the list -->  
    </c:forEach>
  </c:when>
  <c:otherwise><p>My list is empty.</p></c:otherwise>
</c:choose>
Categories: Java Tags: ,