空支票在 JSP 中不起作用
Empty check is not working in JSP
我的代码中有 forEach
。
我尝试检查团队是否为空,如果是,结果应该不是 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>
问题出在 otherwise or if...空队。
它不起作用。
网站上没有显示该字符串。
尝试使用 fn
函数,
<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>
您必须为此添加 <%@ taglib uri="http://java.sun.com/jsp/jstl/functions" prefix="fn"%>
。
我的代码中有 forEach
。
我尝试检查团队是否为空,如果是,结果应该不是 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>
问题出在 otherwise or if...空队。
它不起作用。
网站上没有显示该字符串。
尝试使用 fn
函数,
<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>
您必须为此添加 <%@ taglib uri="http://java.sun.com/jsp/jstl/functions" prefix="fn"%>
。