struts2-----Action的属性注入值
2011-02-23 21:48
387 查看
类:
package control.center;
import java.net.URLEncoder;
public class HelloWordAction {
private String savePath;
public String getSavePath() {
return savePath;
}
public void setSavePath(String savePath) {
this.savePath = savePath;
}
public String execute() throws Exception{
URLEncoder.encode("星期三","UTF-8");
return "hello word!";
}
}
Action配置:
<action name="hello" class="control.center.HelloWordAction" method="execute">
<param name="savepath">/images</param>
<param name="success">/WEB-INF/page/message.jsp</param>
</action>
将路径注入到类的savepath属性中。
在页面上使用:
${savePath}得到savePath的值
访问Action的默认后缀是.action,可以通过struts.action.extenstion修改默认后缀
,在struts配置中使用配置节点:<constant name="struts.action.extension" value="do"/>
此配置将.action修改为.do
package control.center;
import java.net.URLEncoder;
public class HelloWordAction {
private String savePath;
public String getSavePath() {
return savePath;
}
public void setSavePath(String savePath) {
this.savePath = savePath;
}
public String execute() throws Exception{
URLEncoder.encode("星期三","UTF-8");
return "hello word!";
}
}
Action配置:
<action name="hello" class="control.center.HelloWordAction" method="execute">
<param name="savepath">/images</param>
<param name="success">/WEB-INF/page/message.jsp</param>
</action>
将路径注入到类的savepath属性中。
在页面上使用:
${savePath}得到savePath的值
访问Action的默认后缀是.action,可以通过struts.action.extenstion修改默认后缀
,在struts配置中使用配置节点:<constant name="struts.action.extension" value="do"/>
此配置将.action修改为.do
相关文章推荐
- 传智Struts2笔记(5)为Action的属性注入值
- struts2为Action的属性注入值
- Struts2的处理流程及为Action的属性注入值
- 遇到问题:注入 status 属性时、死活进不去action 断点、怀疑是因为status 属性引起的、struts2本身的bug
- struts2 为action属性注入值
- struts2教程:6、为Action属性注入值
- 【Struts2学习笔记(3)】为Action的属性注入值
- struts2学习笔记-------为action的属性注入值
- Struts2的处理流程及为Action的属性注入值
- struts2 中 action 属性自动注入的发现
- Struts2笔记03 为Action的属性注入值
- struts2_4_为Action属性注入值
- struts2_4_为Action属性注入值
- struts2 action属性注入值
- struts2中action属性的依赖注入
- 复习struts2之为action属性注入值
- SSH整合问题:struts2-spring-plugin自动注入action的属性所产生的问题
- Struts2_为Action属性注入值
- struts2为Action的属性注入值
- struts2.Action中的method属性配置