2008-05-09
struts2 redirect-action 传递参数
关键字: 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.
进行上面说明的替换后,就正常了。
评论
Emy
2008-05-11
太菜了,来到入门讨论版块还是都看不懂啊···
liuwei1981
2008-05-11
使用redirect重置链接需要后缀名,使用了redirect——action就不能使用了,就例如使用chain一样,只需要写action的配置名,如果加入后缀名.action,就会报出异常,action未配置正确。
miracle9i
2008-05-09
奇怪了 我带后缀名可以正常跳转啊
发表评论
提醒: 该博客已发表在公共论坛,博客所有留言会成为论坛回贴,留言请注意遵守论坛发贴规则
- 浏览: 25099 次
- 性别:

- 来自: 山西太原

- 详细资料
搜索本博客
我的相册
55_140065_b47aa528cbaf0eb
共 16 张
共 16 张
最新评论
-
列个新年计划吧,不知道到 ...
-- by gkm422 -
列个新年计划吧,不知道到 ...
过去半年了,计划基本没有进展,唉......
-- by liuwei1981 -
列个新年计划吧,不知道到 ...
你好! 能加我QQ 想请教你关于JAVA开发OA的问题 能加我QQ吗? 38 ...
-- by pengjunwu -
修改spring+hibernate+str ...
已经解决·~~哈哈·~~郁闷了一天多~终于搞定了·~
-- by 六芒星の詛咒 -
修改spring+hibernate+str ...
为什么我的还是不行的呀~~~~~我在spring里的配置文件里设置好了呀,可是还 ...
-- by 六芒星の詛咒






评论排行榜