JSTL 的 core标签库(JAVA EL 表达式)

JSTL core标签库

1. <c:out>

   <c:out value="${param.action}"></c:out>

2. <c:if>

   <c:if test="${param.action=='contion'}">
   </c:if>
   
if you need the process is similar to if ... else,  it should be use <c:choose> tag.

3. <c:choose>、 <c:when>、 <c:otherwise>

   <c:choose>
     <c:when test="${condition}">
       // TODO
     </c:when>
     <c:otherwise>
       // TODO
     </c:otherwise>
   </c:choose>
   

4. <c:forEach>

   a) normal round:
      for(int num=2;num<=100;num=num+2){}
      <c:forEach var="num" begin="2" end="100" step="2">
        // TODO
      </c:forEach>   
   
   b) traversal List:
      for(Object person:personList){
        person.getId();
        person.getName();
        person.getAge();
        ...
      }
      <c:forEach items="${personList}" var="person">
        <tr>
           <td>${person.id}</td>
           <td>${person.name}</td>
           <td>${person.age}</td>
           ...
         </tr>
      </c:forEach>
   
   c) traversal Map:
      <c:forEach var="item" items="${Map}">
        <tr>
          <td>${item.key}</td>
          <td>${item.value}</td>
        </tr>
      </c:forEach>
      
   d) Attribute: varStatus
   

5. <c:forTokend>

   <c:forTokend items="AA,BB,CC,DD,EE,FF,GG" delime"," var="item"
     varStatus="varStatus" begin="1" end="7" step="2">
     <tr>
       <td>${varStatus.index}</td>
       <td>${item}</td>
     </tr>   
   </c:forTokend>   
   
   Result:
   1    AA
   3    CC
   5    EE
   7    GG
   

6. <c:set>   


7. <c:remove>


8. <c:catch>


9. <c:import>


10. <c:url>


11. <c:redirect>


12. <c:param>

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值