2

I have the following code :

RequestDispatcher dispatcher = request.getRequestDispatcher(viewName);
// while viewName is another servlet name;
dispatcher.forward(request, response);

It's a successful forwording except parameters are shown in the browser address bar. Something like this:

http://localhost:8080/testweb/action/LoginAction/login?username=apcpros%40163.com&password=12234

I DO NOT want to show any parameters (e.g. username and password) in the browser address bar after forwording. What should I do?

Albert
  • 41
  • 5

1 Answers1

3

Forward as POST and not GET? That's a GET and if it contains parameters they will need to be forwarded, or remove.

  • My class extends HttpServlet. I do forword in the doPost(HttpServletRequest request, HttpServletResponse response) method. In the doGet() method, I just call doPost(). – Albert Jan 16 '16 at 14:04
  • thanks you a lot. I used a GET method in the jsp page. – Albert Jan 17 '16 at 07:06