Reputation: 10049
I'm doing redirection in my servlets but the url is always the same and my post and gat parameters doesn't disappear
RequestDispatcher dispatcher = request.getRequestDispatcher("/");
dispatcher.forward(request, response);
In this exemple the url will not change, but the fetch page will be "/" And my post and get are not destroyed.
I'm trying to find a real redirection as
header("location:/");
in PHP.
Upvotes: 2
Views: 88
Reputation: 51721
Use sendRedirect()
to do a true redirection instead of internal dispatch.
response.sendRedirect("/");
location:
header)Upvotes: 2