- <c:if>没有<c:else>可以用<c:choose>来取代结构:
- <c:choose>
- <c:when test=""> 如果
- </c:when>
- <c:otherwise> 否则
- </c:otherwise>
- </c:choose>
-
- 举一个典型的 <c:choose>、<c:when>和<c:otherwise>范例:
- <c:choose>
- <c:when test="${condition1}">
- condition1为true
- </c:when>
- <c:when test="${ condition2}">
- condition2为true
- </c:when>
- <c:otherwise>
- condition1和condition2都为false
- </c:otherwise>
- </c:choose>

本文介绍如何利用JSTL中的<c:choose>、<c:when>和<c:otherwise>标签进行条件判断,通过具体示例展示了不同条件分支的使用方法。
935

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



