導入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>
</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 --> 生成網址
<c:url var="uurrll" value="/example/ind1ex.jsp">
<c:param name="namechina" value="中國"></c:param>
</c:url>
<a href="${uurrll }">hreftext</a>