【jstl】jsp標準標籤庫——標籤使用方法整理

  1. c:if (沒有c:else)
<c:if test="${age > 20}">age大於20</c:if> //age大於20時,返回true

<c:if test="${falg}">flag爲true</c:if> //flag是一個布爾值,如果不是,那麼頁面會有類型不匹配的報錯

<c:if test="${empty str}">str爲空</c:if>//判空,相當於<s:if test="str==''"></s:if>

<c:if test="${not empty str}">str不爲空</c:if>//判空,相當於<s:if test="str!=''"></s:if>
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章