How to redirect browser from POST request to GET a new location? servlet
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);
}
精彩评论