1. sendRedirect
- response.sendRedirect();
- Server follow the logic, send a link to browser and browser will invoke the link with previous session, request again; The request.setAttribute can’t use.
2. include:
- Will show the content of current page and included page, and the address link not change. And the reques.setAttribute can use
- Servlet: request.getRequestDispatcher(“jsp2.jsp”).include(request, response);
- JSP: <jsp:include page=”include.jsp”/>
3. forward:
- Will show the content of forward page, and the address link not change. And the reques.setAttribute can use
- Servlet: request.getRequestDispatcher(“jsp2.jsp”).forward(request, response);
- JSP: <jsp:forward page=”include.jsp” />