zoukankan      html  css  js  c++  java
  • jstl--->Core 核心标签库->流程控制

    jstl--->Core 核心标签库->流程控制  

      -->if、choose、when、otherwise

       <c:if>条件判断  

        语法1:没有本体内容

         <c:if test="testCondition" var="varName" [scope="{page|request|session|application}"]/>  

        语法2:有本体内容  

        <c:if test="testCondition" [var="varName"] [scope="{page|request|session|application}"]>  本体内容...  </c:if>    

      属性

        test:如果运算式的结果为true则执行本体内容,false则相反  

        var:存储test运算后的结果,true或false  

        scope:var变量的jsp范围    

      栗子:  

      <c:if test="${param.username == 'Admin'}" var="condition" scope="page">

        您好!Admin先生。  

      </c:if>

      </br>  执行结果为:${condition}   

       运算完成会将test的结果赋值给condition存入page中

       <c:choose>本身只当做<c:when>和<c:otherwise>的父标签  

      若要使用<c:when>和<c:otherwise>来做流程控制时,他们必须为<c:choose>的子标签    

      <c:when>  

      语法  <c:when test="testCondition" >  本体内容...        

        </c:when>

         test:如果运算式结果为true,则执行本体内容,false则相反  

      <c:otherwise>  

      所有<c:otherwhen>的test都不为true就执行  

        <c:otherwise>  

        本体内容...  

        </c:otherwise>

     

  • 相关阅读:
    poj 3087 直接模拟
    POJ-3126 BFS,埃式筛选及黑科技
    POJ3278-Catch That Cow
    js变量提升
    饿了么
    2分钟就能学会的【Google/百度搜索大法】了解一下?
    span标签间距
    Vue移动端项目如何使用手机预览调试
    Port 3000 is already in use
    koa2第一天 async详解
  • 原文地址:https://www.cnblogs.com/juniorjava/p/7263923.html
Copyright © 2011-2022 走看看