jsp jstl uses
1.jar package import and page import
jstl-1.2.jar
page to add <%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
2. Usage of <c:forEach> The
items parameter is the traversed object, and var is the current traversed element
2. Usage of <c:if else>, if the value in ${} in <c:when> is true, execute (1), otherwise execute (2)
3. <C:if> If if is true, execute, otherwise do not execute
<c:if test="${1==1}">.....</c:if> //Double quotes here It's required
1.jar package import and page import
jstl-1.2.jar
page to add <%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
2. Usage of <c:forEach> The
items parameter is the traversed object, and var is the current traversed element
<c:forEach items="${employeeList}" var="user"> <tr style="border: 1px solid #ccc;"> <td align="center">${user.id}</td> <td align="center">${user.name}</td> <td align="center"> <c:choose> <c:when test="${user.sex == 0}">Male</c:when> //The double quotes here are required <c:otherwise>女</c:otherwise> </c:choose></td> <td align="center"><c:out value="${user.name }"></c:out>${user.height}</td> </tr> </c:forEach>
2. Usage of <c:if else>, if the value in ${} in <c:when> is true, execute (1), otherwise execute (2)
<c:choose> <c:when test="${user.sex == 0}">(1)</c:when> <c:otherwise>(2)</c:otherwise> </c:choose>
3. <C:if> If if is true, execute, otherwise do not execute
<c:if test="${1==1}">.....</c:if> //Double quotes here It's required