導入Jstl標簽庫
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
需要導入jstl.jar和standard.jar
c:forEach --> 迭代標簽迭代List或Map
<c:forEach var="person" items="${list}">
${person.name }</br>
</c:forEach>
<c:foreach var="entry" items="${map }"> 對map.entrySet()返回的set集合進行迭代
${entry.key } : ${entry.value }
</c:foreach>
<c:forEach var="num" begin="1" end="9" step="1">
${num }
</c:forEach>
<!-- ${status}獲取到了一個對象,這個對象包含了當前是第幾次迭代 -->
<c:forEach var="str" items="${list }" varStatus="status">
<tr class="${status.count%2==0?'even':'odd'}">
</c:forEach>
c:if --> 判斷標簽
<c:if test="${user!=null}" var="result"> user存在的話result就為true
歡迎您:${user.username}
</c:if>
${result }
c:out
<c:out value="${data }" default="aaaaa" escapeXml="true"></c:out>
c:set
<!-- c:set可以操作各個域 javabean Map集合 -->
<c:set var="data" value="xxxxxx" scope="page"></c:set>改變data的值;
<c:set property="propertyname" value="valuexx" target="${map }"></c:set>
${map.propertyname }
<c:set property="name" value="uuuuuu" target="${person }"></c:set>
${p.name }
c:catch
<c:catch var="ex">
<%
int x = 1 / 0;
%>
</c:catch>
${ex.message }
c:forTokens --> 分割標簽
<c:forTokens var="ss" items="${data1 }" delims=",">
${ss }
</c:forTokens>
data1={"a,b,c,d"}
c:url --> 生成URL
<c:url var="uurrll" value="/example/ind1ex.jsp">
<c:param name="namechina" value="中國"></c:param>
</c:url>
<a href="${uurrll }">hreftext</a>