开发者

How to redirect browser from POST request to GET a new location? servlet

开发者 https://www.devze.com 2023-01-06 00:37 出处:网络
I\'m using GAE with Java servlets. I have a form POST request, and I have to redirect the browser to a new location with GET method开发者_开发百科. How can I do this?I got solution:

I'm using GAE with Java servlets. I have a form POST request, and I have to redirect the browser to a new location with GET method开发者_开发百科. How can I do this?


I got solution:

http://en.wikipedia.org/wiki/Post/Redirect/Get

This is my code sample:

private void seeOther(HttpServletResponse resp, String pathOfOtherToSee)
{
    resp.setStatus(HttpServletResponse.SC_SEE_OTHER);
    resp.setHeader("Location", pathOfOtherToSee);       
}
0

精彩评论

暂无评论...
验证码 换一张
取 消