Struts 1 redirect from action to action with parameters as POST request

左心房为你撑大大i 提交于 2019-12-08 01:57:32

问题


now am trying to redirect to action class from action class with some parameters in my Struts 1.3 web application, here is my code

ActionRedirect redirect = new ActionRedirect(mapping.findForward(forwardPage));
redirect.addParameter("method", forwardPage);   
redirect.addParameter("username", "user");
redirect.addParameter("password", "PWD");
redirect.addParameter("forwardPage", "success");        
return redirect;

it's working fine, but all parameters are showed in address bar, how can i redirect it as POST request parameter(hide parameters)


回答1:


You can't, it is not a Struts problem. It is how HTTP is designed. When a browser is redirected, it perform a GET request. You cannot ask the browser to do a POST instead. The only way would be to add some Javascript to send the request.

Or you can also ask Struts to do an internal redirection but it will be hidden to the client and the url will not change.



来源:https://stackoverflow.com/questions/17103749/struts-1-redirect-from-action-to-action-with-parameters-as-post-request

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