多应用+插件架构,代码干净,二开方便,首家独创一键云编译技术,文档视频完善,免费商用码云13.8K 广告
## JSTL标签 #### 开启jstl标签支持 ``` <%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%> <%@taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%> <%@taglib uri="http://java.sun.com/jsp/jstl/functions" prefix="fn"%> ``` #### jsp输出html时去除多余的空行 ``` <%@ page trimDirectiveWhitespaces="true"%> ``` #### 嵌套页面 ``` <c:import url="head.jsp"></c:import> ``` #### 转发 ``` <jsp:forward page="portal/index.action"></jsp:forward> ``` #### if ``` <c:if test="${userInfo.type=='admin'}"> // 执行 </c:if> ``` #### if-else ``` <c:choose> <c:when test="${fn:length(list)==0}"> // 执行 </c:when> <c:otherwise> // 执行 </c:otherwise> </c:choose> ``` #### if-else if-else ``` <c:choose> <c:when test="${userInfo.type=='admin'}"> // 执行 </c:when> <c:when test="${userInfo.type=='teacher'}"> // 执行 </c:when> <c:otherwise> // 执行 </c:otherwise> </c:choose> ``` #### 遍历循环 ``` <c:forEach items="${pageInfo.list}" var="entity" varStatus="status"> <tr> <td>${status.index+1}</td> <td>${entity.userName}</td> <td>${entity.userCode}</td> </tr> </c:forEach> ```