`
Mysun
  • 浏览: 270549 次
  • 性别: Icon_minigender_1
  • 来自: 杭州
社区版块
存档分类
最新评论

webwork type等于redirect时的参数传递

阅读更多
Webwork在使用result类型为redirect时,将会重新发起一个请求,这样前面请求的参数就丢失了,所以在使用redirect时需要人为地在重定向url中加入参数。例如:
<action name="test" class="...">
   <result name="list" type="redirect">
       /test!view.do?param1=${param1}&amp;param2=${param2}
   </result>
</action>

这里有两点需要注意:
1.${param1}不能写成$!{param1}这样的格式,否则将无法正确解析参数
2.多个参数之间的&替换成&amp;,因为xml中不允许出现&符号
另外,两个参数需要在action中同时定义get和set方法。
分享到:
评论

相关推荐

Global site tag (gtag.js) - Google Analytics