1,只要有jar包就行,不需要在web.xml里定義tld。weblogic8不支持1.1
?? 1.0引入
<%@ taglib uri="http://java.sun.com/jstl/core" prefix="c" %>
?? 1.1引入
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
2,<c:choose>
?<c:when test="${role!='admin'}"></c:when>
?<c:otherwise></c:otherwise>
? </c:choose>
3,格式化日期
<%@ taglib uri="http://java.sun.com/jstl/fmt" prefix="fmt"%>
<fmt:formatDate value="${obj.jhdate}" type="both" pattern="yyyy-MM-dd"/>
說(shuō)明見(jiàn)http://freeman983.javaeye.com/blog/96900
4,遍歷
?<c:forEach var="dept" items="${list}">
??? ??? <c:out value="${dept.deptid}"/>
?</c:forEach>
?說(shuō)明
5,<c:out value="${sessionScope.user.name}"/>
?很詳細(xì),有續(xù)一
6,數(shù)組
?? 1.0引入
<%@ taglib uri="http://java.sun.com/jstl/core" prefix="c" %>
?? 1.1引入
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
2,<c:choose>
?<c:when test="${role!='admin'}"></c:when>
?<c:otherwise></c:otherwise>
? </c:choose>
3,格式化日期
<%@ taglib uri="http://java.sun.com/jstl/fmt" prefix="fmt"%>
<fmt:formatDate value="${obj.jhdate}" type="both" pattern="yyyy-MM-dd"/>
說(shuō)明見(jiàn)http://freeman983.javaeye.com/blog/96900
4,遍歷
?<c:forEach var="dept" items="${list}">
??? ??? <c:out value="${dept.deptid}"/>
?</c:forEach>
?說(shuō)明
5,<c:out value="${sessionScope.user.name}"/>
?很詳細(xì),有續(xù)一
6,數(shù)組
<c:forEach items="${sessionScope.department_array}" var="department" varStatus="status">
??department: ${department}_${sessionScope.name_array[status.index]}
</c:forEach>
7, jstl沒(méi)有if/else,用如下的代替,也可以用<c:choose>
<c:if test="1==1"></c:if>
<c:if test="1!=1"></c:if>
8,if /else if/else用如下的寫(xiě)法
<c:choose>
<c:when test="${邏輯判斷}"> </c:when>
<c:when test="${邏輯判斷}"> </c:when>
<c:otherwise>
</c:otherwise>
<c:choose>
9,<c:out value="${arr}" escapeXml="false">
如果arr的值里帶單引號(hào)等,則必須加上屬性escapeXml="false",否則會(huì)出現(xiàn)&XX;之類(lèi)的東西