JavaWeb_day6-EL

EL 表达式语言: ☆  JSP2.0中规范
  1) 语法: ${ 表达式 }   EL可用于所有HTML和JSP标签中


  2) 有效表达式可以包含变量(对象引用)、文字常量、操作符、函数调用
    a) 变量用于存储和访问JSP程序中的值。EL表达式中的变量可以引用存储在标准范围(page,request,session,application)中的属性。变量在标准范围中的搜索顺序是page、request、session、application。
       隐式对象:
         pageContext:  ${pageContext.request.contextPath} 
                 相当于<%= request.getContextPath%> 获取Web应用路径,以/开头
         pageScope: pageContext.setAttribute("name", "zs"); ${pageScope.name}
         requestScope: request.setAttribute("name", "zs"); ${requestScope["name"]}
         sessionScope: session.setAttribute("name", "zs");${sessionScope.name}
         applicationScope:          ${name}
         param: ${param.pwd}  <---> request.getParameter("pwd");
         paramValue: ${paramValue.hobby} <---> request.getParameterValues("hobby");
       initParam: ${initParam.count} <---> servletConfig.getInitParameter("count");
       head: ${head.name}相当于 request.getHeader("name")
       headValues: ${headValues.name}相当于 request.getHeaderValues("name")
       cookie: ${cookie.SESSIONID} 


    b) 常量: 布尔:true false;
             整型:1234; 
             浮点:123.456; 
             字符串:"abc", '你好';${"abcd"} ${'abc'}
             null
    c) 运算符: 
         算术: + - * /(DIV) %(MOD)
         逻辑:&&(and) ||(or) !(not)
         比较:>(gt) >=(ge) <(lt) <=(le) ==(eq) !=(ne)
         条件:表达式 ? 值1 : 值2
         empty: 判断空值或null ${empty null} ${empty ''} ${empty ""} ${!empty null}

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

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

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值