chain类型的ResultType
来源:互联网 发布:中原地产成交数据 编辑:程序博客网 时间:2024/04/30 04:28
“chain”是一种特殊的视图结果,用来将Action执行完之后的结果链接到一个Action继续执行,新的Aciton使用上一个Action的上下文(ActionContext),数据也会被传递。
在Struts 2开发中,一个请求配一个Action处理货后,不是立即产生相应,而是传递到下一个Action中继续处理。
有一个登陆页面,处理的action为HelloWorldAction,有account,password的input控件。
HelloWorldAction
public class HelloWorldActin extends ActionSupport{private String account;private String password;public String execute() throws Exception {this.doAction();return "toSecond";}public void doAction(){system.out.println("The input is===account:"+account+",password:"+password);}// getter/setter第二个Action
public class SecondAction extends ActionSupport{pubilc String execute() throws Exception{System.out.println("Now is SecondAction processing");return "toWelcome";}}struts.xml配置如下
<package name="helloworld" extends="struts-default"><action name="helloworldAction" class="test.action.HelloWorldAction"><result name="toSecond" type="chain"><param name="actionName">secondAction</param></result></action><action name="secondAction" class=""test.action.SecondAction"><result name="toWelcome">/welcome.jsp</result></action></package>
welcome.jsp页面可以获取account,password的值。
tips:
1,chain不能再result配置的时候传参数。下面的错误
<result name="toSecond" type="chain"><param name="actionName">secondAction?account=test</param></result>
2,“Chain”的ResultType再配置的时候,除了actionName外,还有一个参数“namespace”,表示被链接的Action所在包的命名空间,默认为当前的命名空间。
<result name="toSecond" type="chain"><param name="actionName">secondAction</param><param name="namespace">namespace of other package</param></result>
- chain类型的ResultType
- struts2的resultType类型
- struts2 ResultType为chain的使用
- Strut2.1.8.1 resultType Chain
- webwork chain类型的result
- Struts2 resultType返回类型
- struts2 07 结果类型 ResultType
- mybatis resultType返回类型汇总。
- Struts2-ResultType-1-结果类型
- Struts2中result的类型:chain
- resultType之四chain转发到另一个action
- struts2的resultType
- Mybatis的resultType
- mybatis的resultType
- mybatis返回类型resulttype之string和java.lang.string的不同点
- mybatis返回类型resulttype之string和java.lang.string的不同点
- struts2 ResultType四种基本类型
- 关于Struts中结果类型chain的理解
- Android Drawable Resource学习(十)、ScaleDrawable
- 关于监听器
- jquery 对象
- 菜鸟第一次做产品小结
- RIP路由协议及工作原理
- chain类型的ResultType
- js作用域
- 看鸟哥的私房菜记录的笔记(基本命令一)
- SQL入门语句
- 读《JavaScript语言精粹(修订版)》心得
- MongoDB数据库的创建和删除
- MVC设计模式
- html字符转译
- 只想在一个适合的环境,好好学编程!