Struts2 二、为Action的参数注入值
来源:互联网 发布:利用淘宝运费险赚钱 编辑:程序博客网 时间:2024/04/29 21:12
为Action参数注入值,主要使用在的场景为,Action的一个参数的值不是固定的是可以改变的,所以不能直接写在Action中,可以通过Struts配置的方式将值配置到Struts中,然后通过注入的方式将值注入到Action中,下面是代码:
public class HelloAction {public String resultParam;public String sayHello(){return "message";}public String getResultParam() {return resultParam;}public void setResultParam(String resultParam) {this.resultParam = resultParam;}}
struts-config代码:
<package name="hello" namespace="/hello" extends="struts-default"><action name="helloAction_*" class="cn.actions.HelloAction" method="{1}"> <param name="resultParam">我的名字是:</param><result name="message">/WEB-INF/pages/message.jsp</result></action></package>
message.jsp代码:
<body> ${resultParam} 杰克 </body>
访问地址:http://localhost:9000/Struts2/hello/helloAction_sayHello.do
0 0
- Struts2 二、为Action的参数注入值
- 【Struts2】为Action的属性注入值
- struts2为Action的属性注入值
- 传智Struts2笔记(5)为Action的属性注入值
- 传智Struts2笔记(5)为Action的属性注入值
- struts2学习笔记-------为action的属性注入值
- Struts2笔记03 为Action的属性注入值
- struts2 为action属性注入值
- struts2-6为action属性注入值
- 复习struts2之为action属性注入值
- struts2教程:6、为Action属性注入值
- Struts2的处理流程及为Action的属性注入值
- 【Struts2学习笔记(3)】为Action的属性注入值
- 为Action的属性注入值
- struts2 action属性注入值
- struts2的注入参数,获取值
- 为Action属性注入值
- struts2为action设置静态参数
- 优先队列的基本数据结构(2)
- 标准的ALV模式中的表维护程序
- 【设计模式】从菜鸟到大鸟之工厂三姐妹
- SQL数据库查询语句优化
- sizeof()功能
- Struts2 二、为Action的参数注入值
- 致各位IT开发者:IT面试宝典 for Android版 2.0 全新版本发布
- 排序算法:插入排序
- 天声人語 20150902
- HeadFirst设计模式--策略模式
- 重启Mac系统的Spotlight Server
- 网站知识体系
- Q型聚类分析
- Android Studio 将一个android项目当做另外一个android项目的library