浏览 420 次
|
精华帖 (0) :: 良好帖 (0) :: 新手帖 (0) :: 隐藏帖 (0)
|
|
|---|---|
| 作者 | 正文 |
|
时间:2008-05-09 关键字: struts2 redirect-action 传递 参数
在做一个系统,使用struts2框架,在提交一个请求后,将获取的数据对象再要生成一个序列号,为了防止刷新生成冗余序列号,就在请求处理完成后,直接重定向到显示该信息的action中: <action name="enterpreinfo" class="preinfoBusinessAction" method="enterPreinfoSub">
<result name="success" type="redirect-action">
showpreinfo?preinfo.order_number=${preinfo.order_number}&preinfo.company_name=${preinfo.company_name}
</result>
<result name="error" type="redirect">
<param name="location">/error.jsp</param>
</result>
</action>
因为使用了redirect-action,所以要注意不能将showpreinf?preinfo.order_number=${preinfo.order_number}写成showpreinf.action?preinfo.order_number=${preinfo.order_number} 在这个配置文件里,多个参数的连接符使用了"&",但XML的语法规范,应该使用"&"代替"&",原理和HTML中的转义相同,开始没有注意,在struts分析配置文件时,总是报出这样的错误: The reference to entity "preinfo" must end with the ';' delimiter.
进行上面说明的替换后,就正常了。 声明:JavaEye文章版权属于作者,受法律保护。没有作者书面许可不得转载。
|
|
| 返回顶楼 | |
|
时间:2008-05-09
奇怪了 我带后缀名可以正常跳转啊
|
|
| 返回顶楼 | |
|
时间:2008-05-11
使用redirect重置链接需要后缀名,使用了redirect——action就不能使用了,就例如使用chain一样,只需要写action的配置名,如果加入后缀名.action,就会报出异常,action未配置正确。
|
|
| 返回顶楼 | |
|
时间:2008-05-11
太菜了,来到入门讨论版块还是都看不懂啊···
|
|
| 返回顶楼 | |




