• 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>

     

  • 相关阅读:
    绑定class -vue
    二叉树按层打印,并且按层换行的方法
    curl相关知识
    python创建简单的http服务器
    有关rides数据库的想法
    java模拟实现有序表操作
    php静态方法
    php关闭浏览器不终止运行
    php读取图片以二进制输出
    借用face++人脸识别,来识别年龄
  • 原文地址:https://www.cnblogs.com/juniorjava/p/7263923.html
Copyright © 2020-2023  润新知