C标签的用法详解

来源:互联网 发布:江汉大学网络管理系统 编辑:程序博客网 时间:2024/05/17 22:55
  1.  <!-- c:if 相当于  if语句      里面的test  都写 el表达式    -->  
  2.  <!-- c:choose  下面的c:when   相当于 if 和else if    c:otherwise  相当于 else        -->  
  3.  <!-- test el表达式    var 放test的结果   scope 指定放在哪个作用域     not也可以表示 !-->  
  4. <%-- <c:if test="${a>b}" var="result" scope="page">  
  5.     <h1>a大于b</h1>  
  6. </c:if>  
  7. <c:if test="${!result}">  
  8.     <h1>a小于等于b</h1>  
  9. </c:if> --%>   
  10.   
  11. <c:choose>  
  12.     <c:when test="${a>b}">  
  13.         <h1>a大于b</h1>  
  14.     </c:when>  
  15.     <c:when test="${a<b}">  
  16.         <h1>a小于b</h1>  
  17.     </c:when>  
  18.     <c:otherwise>  
  19.         <h1>a等于b</h1>  
  20.     </c:otherwise>  
  21. </c:choose>