Skip to content

Instantly share code, notes, and snippets.

@springcome
Last active December 25, 2015 14:19
Show Gist options
  • Save springcome/6989601 to your computer and use it in GitHub Desktop.
Save springcome/6989601 to your computer and use it in GitHub Desktop.
<c:forEach example
// list
<c:choose>
<c:when test="${empty data}">
<!-- data is empty -->
</c:when>
<c:otherwise>
<c:forEach var="dt" items="${data}" varStatus="status">
<c:out value="${dt.name}" />
</c:forEach>
</c:otherwise>
</c:choose>
// list for list
<c:choose>
<c:when test="${empty data}">
<!-- data is empty -->
</c:when>
<c:otherwise>
<c:forEach var="dt" items="${data}" varStatus="status">
<c:forEach var="child" items="dt.list" varStatus="status">
<c:out value="${child.name}" />
</c:forEach>
</c:forEach>
</c:otherwise>
</c:choose>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment