Can you do a struts2 action redirect using POST instead of GET?

末鹿安然 提交于 2020-01-02 03:44:05

问题


<action name="actionA" class="com.company.Someaction">
 <result name="success" type="redirect-action">
  <param name="actionName">OtherActionparam>
  <param name="paramA">${someParams}</param>
  <param name="paramB">${someParams}</param>
  <param name="aBoatLoadOfOtherParams">${aBoatLoadOfOtherParams}</param>
 </result>
</action>

In the above action map, I am redirecting from SomeAction to OtherAction. I am having issues, because unfortunately I need to pass a large amount of data between the two actions. IE7 will only allow GET requests to be like 2k, so its blowing up when I'm just over that limit when the response calls a get request to the other action.

Is it possible for me to set this redirect, to end up with a POST being called to the other action?


回答1:


As the docs states:

The only way to pass data [after a redirection] is through the session or with web parameters (url?name=value) [i.e., query string for a GET request]

Perhaps a case for action chaining? I'm not sure, and it's not usually recommended, but it seems that you scenario is rather unusual, so it might pay to take a look.

In this case, we are not really making a redirection, i.e., we are not going back to the client, but keeping everything inside the server. Supposedly, then, the full interceptor stack is executed again - and the posted data should impact on the new action, one would hope...



来源:https://stackoverflow.com/questions/2769005/can-you-do-a-struts2-action-redirect-using-post-instead-of-get

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!