辅助进行逻辑判断,一般与el表达式联合使用
引入标签库
<%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
基本用法:
<%--循环--%>
<c:forEach items="${lists}" var="li" >
<h1>${li}</h1>
</c:forEach>
<%--条件判断--%>
<c:if test="${UserBean.getId()==111}">
userBean.id=111
</c:if>
<%--相当于java中的: if(){}else if(){}else if(){}else if(){}else{}--%>
<c:choose>
<c:when test="${UserBean.getId()>112}">
UserBean.id>112
</c:when>
<c:when test="${UserBean.getId()>110}">
UserBean.id>110
</c:when>
<c:otherwise>
UserBean
</c:otherwise>
</c:choose>
本文详细介绍了JSTL标签库中核心标签的使用方法,包括如何进行循环遍历和条件判断等常见操作,提供了具体的示例代码帮助理解。
889

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



