• EL表达式获取请求


    1EL 表达式语法: ${ EL 表达式}    它的特点: 1自动转换类型,  2使用简单。

    2 EL表达式具有类型无关性,可以使用“.”或者“[]”操作符在相应的作用域(page  ,  request ,session  ,application)中取得某个属性的值。

    3 EL表达式提供了pageScope, requestScope, sessionScope, applicationScope, param,  paramValues,  pageContext 等隐式对象。

    <html>
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
    <title>Insert title here</title>
    </head>
    <body>
        <c:if test="${not empty    requestScope.msg}"></c:if>
        <h1>${requestScope.msg}</h1>
    </body>
    </html>

    4 ${requestScope.msg}   与请求作用域(request)中属性相关联的Map类。获取请求参数

    request.setAttribute("msg", "密码错误,请重新输入!");   用request传递参数

    request.setAttribute("msg", "用户" + name + "登录成功");

    5  <c:if>  用于实现java语言的if语句功能  条件标签

    <c:if test="${not empty    requestScope.msg}">  主体内容 </c:if>

    test判断条件  ${not empty    requestScope.msg} 表示式或condition结果为true,会执行主体内容,false不会执行。

    6  Empty 操作符是一个前缀操作符,用于检测一个值是否为null或者为empty。

    ${not empty    requestScope.msg} 或${!empty    requestScope.msg} 返回结果为false。

    ${  empty  requestScope.msg} 返回结果为true。

  • 相关阅读:
    2020 CCPC-Wannafly Winter Camp Day6 ---I. 变大!
    Codeforces 1295F Good Contest
    2020 CCPC-Wannafly Winter Camp Day6 ---A. Convolution
    centos下kubernetes+flannel部署(旧)
    无网络centos7中部署kubernetes
    利用Openvswitch实现不同物理机中的Docker容器互连
    docker-py的配置与使用
    通过Docker配置DNS服务器
    在 OS X Yosemite 中部署Mesos
    Docker初识
  • 原文地址:https://www.cnblogs.com/TangGe520/p/8616082.html
Copyright © 2020-2023  润新知