JSTL标签 参考手册:https://blog.csdn.net/elf8848/article/details/83287100
菜鸟教程:https://www.runoob.com/jsp/jstl-core-choose-tag.html
c标签判断两个值是否相等
Integer用:${user1.id eq user2.id};
int用:${user1.id == user2.id}
测试代码如下:
<c:if test="${not empty listByParentId }">
<c:forEach items="${listByParentId }" var="listByParentId">
<c:if test="${listByParentId.parentId eq list.cwId }">
…………
…………
…………
</c:if>
</c:forEach>
</c:if>
菜鸟:
<%@ page language="java" contentType="text/html; charset=UTF-8"
pageEncoding="UTF-8"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<html>
<head>
<title>c:choose 标签实例</title>
</head>
<body>
<c:set var="salary" scope="session" value="${2000*2}"/>
<p>你的工资为 : <c:out value="${salary}"/></p>
<c:choose>
<c:when test="${salary <= 0}">
太惨了。
</c:when>
<c:when test="${salary > 1000}">
不错的薪水,还能生活。
</c:when>
<c:otherwise>
什么都没有。
</c:otherwise>
</c:choose>
</body>
</html>
二号
<c:set var="num" scope="page" value="admin"></c:set>
<c:choose>
<c:when test="${num=='guest' }">
<c:out value="admin"></c:out>
</c:when>
<c:when test="${num=='admin' }">
<c:out value="admin"></c:out>
</c:when>
<c:otherwise>
<c:out value="other"></c:out>
</c:otherwise>
</c:choose>