Reputation: 135
I have my forEach
in my code.
I try to check is the teams are empty, if that is true, result should be other than false.
<tbody>
<c:forEach items="${teams}" var="team">
<c:choose>
<c:when test="${not empty teams}">
var1 is NOT empty or null.
</c:when>
<c:otherwise>
var is empty!
</c:otherwise>
</c:choose>
</c:forEach>
</tbody>
The problem is with otherwise or if... empty teams.
It is'not working.
That string is not showing on a website.
Upvotes: 0
Views: 834
Reputation: 3090
Try using the fn
function,
<tbody>
<c:forEach items="${teams}" var="team">
<c:choose>
<c:when test="${fn:length(teams) > 0}">
var1 is NOT empty or null.
</c:when>
<c:otherwise>
var is empty!
</c:otherwise>
</c:choose>
</c:forEach>
</tbody>
You have to include <%@ taglib uri="http://java.sun.com/jsp/jstl/functions" prefix="fn"%>
for this.
Upvotes: 1