Result类型

Result类型

Webwork提供了一些com.opensymphony.xwork.Result接口的实现来使你的action可以容易的用户交互.这些Result类型包括:

Result定义在xwork xml配置文件(xwork.xml)中的action标签里。如果location参数是result标签的唯一的参数,你可以这样简化:

<action name="bar" class="myPackage.barAction">
 <result name="success" type="dispatcher">
 <param name="location">foo.jsp</param>
 </result>
 </action>
或者
< action  name ="bar"  class ="myPackage.barAction" >   
  < result  name ="success"  type ="dispatcher" >foo.jsp </ result >  
</action >

如果你扩展了webwork-default.xml, 那么默认的返回类型是"dispatcher". 同样,如果你没有指定result的名字,默认将是"success". 就是说你可以如下简化:

< action  name ="bar"  class ="myPackage.barAction" >  
  <result>foo.jsp</result > 
</ action >

注意 : Parse属性允许的location参数作为表达式.例如你可以这样用:
Struts2中从一个Action跳转到另一个action,必须将type="redirect"

<result name ="success" type ="redirect" >/displayCart.action?userId=${userId} 
</ result >


转载于:https://my.oschina.net/jawayjiang/blog/88161

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值