zoukankan      html  css  js  c++  java
  • 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。

  • 相关阅读:
    Hdu4547CD操作离线lca
    1036: [ZJOI2008]树的统计Count树链剖分
    light1348Aladdin and the Return Journey树链剖分
    Problem 2082 过路费树链剖分
    2243: [SDOI2011]染色树链剖分
    Poj3237Tree 树链剖分
    Poj2763Housewife Wind树链剖分
    Hdu5087Revenge of LIS II简单dp
    Hdu5088Revenge of Nim II高斯消元
    Bootstrap入门学习笔记(只记录了效果)
  • 原文地址:https://www.cnblogs.com/TangGe520/p/8616082.html
Copyright © 2011-2022 走看看