JSTL 과 EL 표현 식

2053 단어 jstl
JSTL 과 EL 표현 식 
 、       
1、 jsp          
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%> 

2、         ,          
<%@ taglib prefix="fn" uri="http://java.sun.com/jsp/jstl/functions" %> 

3、    jstl         
${user}   ,user     
<c:if test="${empty user}">   !</c:if>   
<c:if test="${!empty user}">  </c:if>   

4、          
${fn:length(   <   session         sessionScope. >)} 
${fn:length(map)} 

5、       session    ? 
${sessionScope. .    } 

6、varStatus          
 :<tag:forEach var="currentFood" items="${sessionScope.foods}" varStatus="status" 
<tag:if test="${status%2==1}"> 
..................... 
</tag:if> 
</tag:forEach> 
  status                

7、    Map   
<c:forEach var="foodmap" items="${sessionScope.cart}" varStatus="status"> 
<c:set var="subtotal" value="${foodmap.value.bean.foodPrice*foodmap.value.quantity}"></c:set> 
</c:forEach> 
  Map    : 
foodmap:  session  map 
foodmap.value:  map  ,      map       
         ,   foodmap.value.quantity       (quantity       ) 
8、            
<c:forEach var="customer" items="${customers}"> 
    <tr> 
      <td><c:out value="${customer.lastName}"/></td> 
      <td><c:out value="${customer.phoneHome}" default="no home phone specified"/></td> 
      <td> 
        <c:out value="${customer.phoneCell}" escapeXml="false"> 
          <font color="red">no cell phone specified</font> 
        </c:out> 
      </td> 
    </tr> 
</c:forEach> 

좋은 웹페이지 즐겨찾기