轉jstl的一些用法

1.用於根據不同的值顯示對應的內容,不能選擇

複製代碼
<select name="grade">
<c:choose>
    <c:when test="${grade == 'A'}">
        <option value="A" selected>A</option>
    </c:when>
    <c:when test="${grade == 'B'}">
        <option value="B" selected>B</option>
    </c:when>
    <c:when test="${grade == 'C'}">
        <option value="C" selected>C</option>
    </c:when>
</c:choose>
</select>        
複製代碼

 

2.用於根據值設置select的默認選項,可以選擇

<select name="grade">
    <option value="A" <c:if test="${grade=='A'}">selected</c:if>>A</option>
    <option value="B" <c:if test="${grade=='B'}">selected</c:if>>B</option>
    <option value="C" <c:if test="${grade=='C'}">selected</c:if>>C</option>
</select>




JSTL轉義:<c:out value="${notifyTemplate.content}" ></c:out>


發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章