Struts2 中#、@、%和$符号的用途
来源:互联网 发布:白熊事务所装软件 编辑:程序博客网 时间:2024/05/23 01:24
一.#符号的用途一般有三种。
“#”主要有三种用途:
二.%符号
%符号的用途是在标志的属性为字符串类型时,转换为计算OGNL表达式的值。如下面的代码所示:
构造Map
<s:set name=”foobar” value=”#{’foo1′:’bar1′, ‘foo2′:’bar2′}” />
The value of key “foo1″ is <s:property value=”#foobar['foo1']” />
不使用%:<s:url value=”#foobar['foo1']” />
使用%:<s:url value=”%{#foobar['foo1']}” />
三.$符号
$符号主要有两个方面的用途。
<validators>
</validators>
2、动态的结果集(dynamic result)
<struts>
</struts>
注:${}:作用是用于在配置文件中从Value stack(值栈)中取值。
注:此处的${}不是el表达式。
get/set方法。
public class UserAction extends ActionSupport {
}
四、@符号
package com. wjt276.struts2.ognl;
public class S {
}
<li>访问静态方法:<s:property value="@com.wjt276.struts2.ognl.S@s()"/></li>
<li>访问静态属性:<s:property value="@com.wjt276.struts2.ognl.S@STR"/></li>
<li>访问Math类的静态方法:<s:property value="@@max(2,3)" /></li>
小结:
$ # % @
a)
b)
c)
d)
- Struts2 中#、@、%和$符号的用途
- Struts2 中#、@、%和$符号的用途
- Struts2 中#、@、%和$符号的用途
- Struts2 中#、@、%和$符号的用途
- Struts 2中#、%和$符号的相应用途
- DTD 符号的用途
- Struts2中#,$,%符号的使用
- Struts2中#、%和$这三个符号的使用方法
- c++中:和::的用途
- STRUTS2.xml配置文件中action里的name和method用途解析
- STRUTS2标签中符号#,$,%的用法示例
- STRUTS2标签中符号#,$,%的用法示例
- STRUTS2标签中符号#,$,%的用法示例
- STRUTS2标签中符号#,$,%的用法示例
- Struts2中#,$,%等符号的使用
- STRUTS2标签中符号#,$,%的用法示例
- JAVA中super 和 this的用途
- struts中#、%和$这三个符号的使用方法【摘自max struts2教程】
- SQLServer事务的隔离级别
- 数据库事务,脏读、不可重复读、幻读
- linux out of memory
- 1027. Colors in Mars (20)-PAT
- 52控制mc35i
- Struts2 中#、@、%和$符号的用途
- DBus初识
- 观察者设计模式
- Java 读写锁的应用 自定义的缓存系统
- Struts2标签 %{ } %{# }
- 【索引】AOAPC I: Beginning Algorithm Contests (Rujia Liu)
- LeetCode-Multiply Strings
- 软件更新
- struts1.1介绍