我使用Struts 2.3.16.3。我希望 webapp 1 中的操作将参数传递给 webapp 2 中的操作。在 webapp 1 的 struts.xml 中,我定义了以下结果:
<result name="success" type="redirect">
<param name="location">http://localhost:8080/Webapp2/index.action</param>
<param name="testParam">testValue</param>
</result>
我希望当结果等于“成功”时,我的浏览器将我重定向到此网页(webapp2 中的页面):
http://localhost:8080/Webapp2/index.action?testParam=testValue
但是,我的浏览器将我带到:
http://localhost:8080/Webapp2/index.action
完全忽略参数。
如果我将结果更改为将所有内容都包含在位置参数中,那么它就可以工作,但是您可以看到,如果有多个参数,这会变得非常笨重:
<result name="success" type="redirect">
<param name="location">http://localhost:8080/Webapp2/index.action?testParam=${testValue}</param>
</result>
这可以正确地将我的浏览器重定向到以下网址:
http://localhost:8080/Webapp2/index.action?testParam=testValue
为什么第一种方法不起作用?
If the location
以。。开始http:
, https:
, mailto:
, file:
, ftp:
然后将其用作重定向的最终位置response.sendRedirect()
。结果中的参数使用<param>
在这种情况下,标签将被忽略。
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)