語法為:「empty」、「not empty」。

<c:if test="${empty var1}">
    var1 is empty or null.
</c:if>
<c:if test="${not empty var1}">
    var1 is NOT empty or null.
</c:if>

留意:被測試的值(如上的var1)不管為 null 或 空值,都視為「empty」。

參考:
jsp - Evaluate empty or null JSTL c tags - Stack Overflow
 

 

arrow
arrow

    Robert 發表在 痞客邦 留言(0) 人氣()