jsp页面导入:
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
使用语法:
<c:choose>
<c:when test="${c.id == '1'}"><!-- if (id==1) -->
<!-- 执行code -->
</c:when>
<c:when test="${c.id == '2'}"><!-- if (id==2) -->
<!-- 执行code -->
</c:when>
<c:otherwise> <!-- else(id==其他) -->
<!-- 执行code -->
</c:otherwise>
</c:choose>
注意点:标签里面上不能有任何注释的。
<c:choose>
<c:when test="${a=='1'}">
</c:when>
<c:when test="${a=='2'}">
</c:when>
<c:otherwise>
</c:otherwise>
</c:choose>
本文详细介绍了JSP页面中如何使用<c:choose>标签进行条件判断,包括<c:when>和<c:otherwise>子标签的具体用法,以及注意事项。
1万+

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



