日期:2014-05-17  浏览次数:20892 次

struts2请求重定向传多个参数问题
请求重定向到一个页面按如下配置没有问题:
<result name="goto" type="redirect">http://localhost:8080/system/sysLogin.html?method=validatorAjax</result>
加入一个参数,
<result name="goto" type= "redirect">http://localhost:8080/system/sysLogin.html?method=validatorAjax&userName=${userName}</result> 
配置文件报错,按提示更改的写法如下都不好用。
<result name="goto" type= "redirect">http://localhost:8080/system/sysLogin.html?method=validatorAjax;userName=${userName}</result> 
<result name="goto" type= "redirect">http://localhost:8080/system/sysLogin.html?method=validatorAjax
<param name="userName">${userName}</param>
</result> 
那么传递多个参数应该如何写
struts redirect

------解决方案--------------------
<package name="passingRequestParameters" extends="struts-default" namespace="/passingRequestParameters">
   <-- Pass parameters (reportType, width and height) -->
   <!--
   The redirect-action url generated will be :
   /genReport/generateReport.jsp?reportType=pie&width=100&height=100#summary
   -->
   <action name="gatherReportInfo" class="...">
      <result name="showReportResult" type="redirect">
         <param name="location">generateReport.jsp</param>
         <param name="namespace">/genReport</param>
         <param name="reportType">pie</param>
         <param name="width">100</param>
         <param name="height">100</param>
         <param name="anchor">summary</param>
      </result>
   </action>
</package>

参考下
------解决方案--------------------
http://blog.sina.com.cn/s/blog_6c9d5da50100y41l.html