The first implementation method:
It can realize the function of redirecting to the include.jsp page
It is equivalent to the page redirection in Servlet:
RequestDispacher rd = request.getRequestDispacher("include.jsp");rd.forward(request, response);
Copy after login
The second implementation method:
response.sendRedirect("include.jsp");
Copy after login
The second implementation method: Equivalent to:
response.setStatus(302);response.setHeader("location", "include.jsp");
Copy after login
The difference between the two:
The first one:
Readable The request object before redirection; the address after redirection does not change and is still the original address; it cannot be redirected to pages other than this web project; it sends a request to the server once and the speed is relatively fast
The second type:
Not possible Read the request object before redirection; the address after redirection changes to the address of the redirected target page; it can be redirected to pages other than this web project; sending two requests to the server is relatively slow