空检查在JSP中不起作用

时间:2016-10-26 12:42:02

标签: jsp for-loop is-empty

我的代码中有forEach

我尝试检查团队是否为空,如果是真的,结果应该是假的。

<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>

问题在于否则或者......空团队。

它无法正常工作。

该字符串未在网站上显示。

1 个答案:

答案 0 :(得分:1)

尝试使用int value = 123; while (value > 0) { int digit = value % 10; if(digit%2 == 0) { flag =true; } else { flag = false; value = value + 1; continue; } value /= 10; } printf("Value = %d",Value) 功能

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>