这个非常简单,只是长时间不用jsp,有些东西忘了,所以这里单独记录一下。
判断为空使用empty,判断非空使用not empty,如下:
<div id="auth_schools">
<span>已授权学校:</span>
<c:if test="${not empty requestScope.authSchools}">
<c:forEach items="${requestScope.authSchools}" var = "sch">
<span style="font-weight: bold;">${sch.name}</span> /
</c:forEach>
</c:if>
<c:if test="${empty requestScope.authSchools}">
<span style="font-weight: bold;">暂无授权任何学校!</span>
</c:if>
</div>
针对空和非空,在页面中做不同的处理,这是很常见的用法,稍微注意一下即可。
171万+

被折叠的 条评论
为什么被折叠?



