06-struts2与ognl的结合
2024-08-27 04:56:51
1 参数接收
2 配置文件中
1 Demo2Action
package www.test.c_config; import com.opensymphony.xwork2.ActionSupport; public class Demo2Action extends ActionSupport { private String name;
public String execute() throws Exception {
name="lucy";//从数据库中查询到的
return SUCCESS;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
} }
2 struts.xml
<action name="Demo2Action" class="www.test.c_config.Demo2Action"
method="execute">
<result name="success" type="redirectAction">
<!--action的名字 -->
<param name="actionName">Demo1Action</param>
<!--访问action的命名空间 -->
<param name="namespace">/</param> <!-- 如果添加的参数struts"看不懂".就会作为参数附加重定向的路径之后.
如果参数是动态的.可以使用${}包裹ognl表达式.动态取值 --> <param name="name">${name}</param>
</result>
</action>
最新文章
- sqlalchemy多表联合查询(join)
- 205 Isomorphic Strings
- ittype导师课程 - SAP顾问课程,云课堂,个性辅导
- C#多线程与UI响应 跨线程更新UI
- *[topcoder]TheTree
- uva 11922 - Permutation Transformer
- TreeView绑定无限层级关系类
- (三目运算符)PHP中问号?和冒号: 的作用
- MSSQl 事务的使用
- zoj 3950 how many nines
- c语言的第四次作业
- Python虚拟环境笔记
- zookeeper的监控
- luogu P2303 [SDOi2012]Longge的问题
- [原创]H5前端性能测试工具介绍
- hive中创建子表并插入数据过程初始化MR报错解决方法
- 3. sklearn的K-Means的使用
- 006-jdk1.5版本新特性
- mkdirp——递归创建目录及其子目录
- JavaScript字符串数组拼接的性能测试及优化方法