How to make a user redirect when servlet responds with saving the current request data?

I created an index.html page in which I made a form to fill out (login, password). Given through the action form sent to the servlet. Question: How can I transfer a user to another html page, while inserting data from servlet variables?

1 answer 1

HttpServletRequest has a getRequestDispatcher(String path) method getRequestDispatcher(String path) - implemented from the ServletRequest interface that returns a RequestDispatcher object, which in turn has: public void forward(ServletRequest request, ServletResponse response);

More information on the work of these methods and classes can be found here:

1) http://docs.oracle.com/javaee/6/api/javax/servlet/ServletRequest.html#getRequestDispatcher(java.lang.String)

2)

http://docs.oracle.com/javaee/6/api/javax/servlet/RequestDispatcher.html#forward(javax.servlet.ServletRequest, javax.servlet.ServletResponse)