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

I am using GAE with Java servlets. I have a POST request of the form, and I have to redirect the browser to a new location using the GET method. How can i do this?

+4
source share
1 answer

I got a solution:

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

This is my sample code:

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

Source: https://habr.com/ru/post/1314543/


All Articles