1、访问值栈中的action的普通属性: username = <s:property value="username"/>
2、访问值栈中对象的普通属性(get set方法):
<s:property value="user.age"/>
<s:property value="user['age']"/>
<s:property value="user[\"age\"]"/>
wrong: <%--<s:property value="user[age]"/>--%>
3、访问值栈中对象的普通属性(get set方法): <s:property value="cat.friend.name"/>
4、访问值栈中对象的普通方法:<s:property value="password.length()"/>
5、访问值栈中对象的普通方法:<s:property value="cat.miaomiao()" />
6、访问值栈中action的普通方法:<s:property value="m()" />
7、访问静态方法:<s:property value="@com.bjsxt.struts2.ognl.S@s()"/>
8、访问静态属性:<s:property value="@com.bjsxt.struts2.ognl.S@STR"/>
9、访问Math类的静态方法:<s:property value="@@max(2,3)" />
10、访问普通类的构造方法:<s:property value="new com.bjsxt.struts2.ognl.User(8)"/>
11、访问List:<s:property value="users"/>
12、访问List中某个元素:<s:property value="users[1]"/>
13、访问List中元素某个属性的集合:<s:property value="users.{age}"/>
14、访问List中元素某个属性的集合中的特定值:
<s:property value="users.{age}[0]"/>
<s:property value="users[0].age"/>
15、访问Set:<s:property value="dogs"/>
16、访问Set中某个元素:<s:property value="dogs[1]"/>
17、访问Map:<s:property value="dogMap"/>
18、访问Map中某个元素:
<s:property value="dogMap.dog101"/>
<s:property value="dogMap['dog101']"/>
<s:property value="dogMap[\"dog101\"]"/>
19、访问Map中所有的key:<s:property value="dogMap.keys"/>
20、访问Map中所有的value:<s:property value="dogMap.values"/>
21、访问容器的大小:
<s:property value="dogMap.size()"/>
<s:property value="users.size"/>
22、投影(过滤):<s:property value="users.{?#this.age==1}[0]"/>
23、投影:<s:property value="users.{^#this.age>1}.{age}"/>
24、投影:<s:property value="users.{$#this.age>1}.{age}"/>
25、投影:<s:property value="users.{$#this.age>1}.{age} == null"/>
26、[]:<s:property value="[0].username"/>
分享到:
相关推荐
struts2 OGNL之<s:property>标签访问值栈(value stack)用法,希望能对大家有帮助
第3章 章 Struts 2 的标签库 3.1 Struts 2 的OGNL 3.2 Struts 2 的标签库 ...<s:action name="action" executeResult="true"></s:action> <!--这句不会显示 --> <s:action name="action"></s:action> </body> </html>
A.<s:property value=”{’Jack’,’Rose’,’Andy’}” scope=“request”/> B.<s:property set=”{‘Jack’,’Rose’,’Andy’}” scope=”request”/> C.<s:set var=”names” value=”{‘Jack’,’Rose’,’Andy...
Struts2的一个关键特性就是它可以对Action携带的数据进行读写访问,例如在前面我们在表单中使用user.username指定数据传递给Action的user对象的username属性,在<s:property>元素中使用user.username来获取用户的...
赠送jar包:ognl-3.2.21.jar;...使用方法:解压翻译后的API文档,用浏览器打开“index.html”文件,即可纵览文档内容。 人性化翻译,文档中的代码和结构保持不变,注释和说明精准翻译,请放心使用。
赠送jar包:ognl-3.1.12.jar;...使用方法:解压翻译后的API文档,用浏览器打开“index.html”文件,即可纵览文档内容。 人性化翻译,文档中的代码和结构保持不变,注释和说明精准翻译,请放心使用。
ognl 对象图导航语言 struts2框架默认 ...<s:property value="#"></s:property> 除了ValueStack不加#,直接取用,其他都要加#,ActionContent用#name或其他对象#相应对象.name ActionContent用#name?
10.1 sitemesh基本使用方法 194 10.2 sitemesh高级应用 198 10.2.1 <page:applyDecorator>和<decorator:getProperty>标签的使用介绍 198 10.2.2 <decorator:usePage>、<decorator:useHtmlPage>和<decorator:head>...
<br>04 在Struts 2.0中国际化(i18n)您的应用程序<br>05 转换器(Converter)——Struts 2.0中的魔术师<br>06 在Struts 2.0中实现表单数据校验...Struts 2中的OGNL<br>12 trus 2的新表单标志的使用<br>13 Struts 2与AJAX
1. 导入的包<br><br>l ...<br><br>ognl-2.6.9.jar;<br><br>struts-core-2.0.6.jar;<br><br>xwork-2.0.0.jar.<br><br>l spring的核心包:spring.jar<br><br>l 二者集成开发所需的包:struts-spring-plugin-2.0.6.jar<br>
其它的运行符可以作用于数字和日期,但不能作用于字符串,大部分的时候,使用gt等字母运算符代替>会有更好的效果,因为 FreeMarker会把>解释成FTL标签的结束字符,当然,也可以使用括号来避免这种情况,如:<#if (x>y)> ...
OGNL是通常要结合Struts 2的标志一起使用,如<s:property value="xx" />等。大家经常遇到的问题是#、%和$这三个符号的使用。下面我想通过例子讲述这个问题: 首先新建名为Struts2_OGNL的Web工程,配置开发环境。之前...
JS:ognl表达式 JS:ognl表达式 JS:ognl表达式
<s:text name="validation.required" > 人心的功能,如将Action输出到FreeMaker模板、Velocity模板、JasperReports和使用XSL转换等。这些都过result里的type(类型)属性(Attribute)定义的。另外,您还可以自定义...
使用的ognl,正对是struts2 hibernate 等
该项目使用的jar包为以下.<br>spring-beans.jar <br>xwork-2.0.4.jar <br>spring-context.jar <br>ognl-2.6.11.jar <br>spring-web.jar <br>spring-core.jar <br>struts2-core-2.0.11.1.jar <br>commons-logging-...
使用方法:解压翻译后的API文档,用浏览器打开“index.html”文件,即可纵览文档内容。 人性化翻译,文档中的代码和结构保持不变,注释和说明精准翻译,请放心使用。 双语对照,边学技术、边学英语。
通用电子商务购物平台 --------目的----------- 1.将前期学习技术熟练应用 2.了解项目开发流程,培养开发能力(编码能力、查错排错能力、自学新技术... <s:iterator value="list" var="l">对应与action里的getLIst方法。
<br><br>可选功能:<br>打印支持,生成打印控制界面,允许开发者设置页面的Head区域和Foot区域,允许用户选择纸张类型、可显示列。该功能需要第三方控件的支持。<br><br>分组聚合运算,指定表格根据哪些对象属性对...
使用方法:解压翻译后的API文档,用浏览器打开“index.html”文件,即可纵览文档内容。 人性化翻译,文档中的代码和结构保持不变,注释和说明精准翻译,请放心使用。 双语对照,边学技术、边学英语。