struts2 配置文件 重定向 redirect (带参数) 的写法
2013-07-02 22:14
429 查看
对于所有重定向写法中URL的各参数间需要以&连接,而不能以&连接!
否则报如下错误:
The reference to entity "arg2" must end with the ';' delimiter.
【第一种写法】:使用Dispatch形式
[html] view
plaincopyprint?
<action name="*tAction" class="tAction" method="{1}">
<result name="test" type="redirect">testtAction.action?arg1=${arg1}&arg2=${arg2}</result>
</action>
注意:
当使用DispatchAction时(在action标签中的name使用了通配符*匹配方法名),此时type=“redirect”而不能写成type=“redirect-action”。
此时在重定向的配置中,需要写完全连接,即XXAction.action?...而不能写成XXAction?...
【第二种写法】:使用完全Action路径形式:
[html] view
plaincopyprint?
<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}
否则报如下错误:
The reference to entity "arg2" must end with the ';' delimiter.
【第一种写法】:使用Dispatch形式
[html] view
plaincopyprint?
<action name="*tAction" class="tAction" method="{1}">
<result name="test" type="redirect">testtAction.action?arg1=${arg1}&arg2=${arg2}</result>
</action>
注意:
当使用DispatchAction时(在action标签中的name使用了通配符*匹配方法名),此时type=“redirect”而不能写成type=“redirect-action”。
此时在重定向的配置中,需要写完全连接,即XXAction.action?...而不能写成XXAction?...
【第二种写法】:使用完全Action路径形式:
[html] view
plaincopyprint?
<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}
相关文章推荐
- Struts2配置文件中redirect传递中文参数乱码的解决办法!
- struts2 配置文件详解 type="stream chain dispatcher、redirect(redirect-action)"
- Struts2配置文件中传递参数
- Struts2配置文件中传递参数的一个小问题
- struts2配置文件传参数的问题
- struts2 配置文件中传递参数
- Struts2 配置文件 type="redirect"的作用
- struts2配置文件传输多个参数
- MyBatis中,传String类型参数到xml配置文件,并执行SQL语句后返回String类型的结果写法(jeesite)
- struts2 xml配置文件配置传参数
- struts2配置文件中参数的传递
- Struts2中,action配置文件中两个action带参数的调用
- struts2配置文件中参数的传递
- struts2配置文件中动态参数
- 修改Struts2的struts.xml配置文件位置和名称-重点是init-param参数用来切换加载的路径
- Struts2中action重定向跳转到jsp页面两种配置方式带参数
- struts2配置文件配置action时结果集传多个参数
- 【struts2配置】result type="redirect"传参数问题
- struts2的配置文件的参数注入原理
- Struts2配置文件中传递参数的一个小问题