Struts 2中OGNL表达式
来源:互联网 发布:时间序列预测值算法 编辑:程序博客网 时间:2024/05/16 05:30
主要是#、%和$这三个符号的使用。使用方法如下:
#”主要有三种用途:
1.访问OGNL上下文和Action上下文,#相当于ActionContext.getContext();几个ActionContext中有用的属性:
parameters 包含当前HTTP请求参数的Map
#parameters.id[0]作用相当于request.getParameter("id")
request 包含当前HttpServletRequest的属性(attribute)的Map
#request.userName相当于request.getAttribute("userName")
session 包含当前HttpSession的属性(attribute)的Map
#session.userName相当于session.getAttribute("userName")
application 包含当前应用的ServletContext的属性(attribute)的Map
#application.userName相当于application.getAttribute("userName")
attr 用于按request > session > application顺序访问其属性(attribute)
#attr.userName相当于按顺序在以上三个范围(scope)内读取userName属性,直到找到为止
2.用于过滤和投影(projecting)集合,如books.{?#this.price<100};
3.构造Map,如#{'foo1':'bar1', 'foo2':'bar2'}。
"%"符号的用途是在标志的属性为字符串类型时,计算OGNL表达式的值。
类似js中的eval:<s:url value="%{#myMap['key1']}"/>
"$"有两个主要的用途,用于在国际化资源文件中,引用OGNL表达式。在Struts 2和i18n中配置文件
<action name="saveUser" class="userAction" method="save">
<result type="redirect">listUser.action?msg=${msg}</result>
</action>
- Struts 2中OGNL表达式
- struts中OGNL表达式
- Struts 2的OGNL表达式
- struts 2的OGNL表达式
- Struts中OGNL与EL表达式
- Struts中OGNL与EL表达式
- Struts中OGNL与EL表达式
- Struts中OGNL与EL表达式
- Struts中OGNL表达式的作用
- Struts 2中的表达式语言-OGNL
- Struts 2 OGNL 表达式语言教程
- Struts的OGNL表达式
- struts专题 OGNL 表达式
- Struts的OGNL表达式
- struts--ognl表达式
- struts中的ognl表达式
- Struts框架中OGNL标签与EL标签表达式使用
- 简单学习struts标签中使用ognl表达式
- URL中传中文的解决方法
- 如何将oracle表中的字段类型、字段注释说明、字段名一起查询出来
- windows消息码大全
- java设置代理访问URL
- ffmpeg开发中出现的问题(二)
- Struts 2中OGNL表达式
- 对于session与cookie机制,自己的一点理解
- asp.net中的跨页发送(利用PreviousPage.FindControl()方法取值)
- 《Oracle Applications DBA 基础》- 9 - Concurrent Processing
- 企业要什么样的“云”
- 第一篇呦~
- 排序:快速排序
- Linux rm 那点事
- 理解HTTP/304响应