JSTL 判断对象是否为空

<c:if 判断对象或集合是否为空

判断集合和对象是否为空:

list为集合,user为对象名
<c:if test="${empty user}">无user信息!TODO...</c:if>为空
<c:if test="${!empty list}">list集合不为空判断,TODO...</c:if>非空

 

<s:if 判断对象是否为空

<s:if test="null==user||user.isEmpty()">
集合为空
</s:if><s:else>
集合不为空
</s:else>

or
<s:if test="null!=user&&!user.isEmpty()">
集合不为看空
</s:if>

原文地址:https://www.cnblogs.com/jackydalong/p/3085506.html