请求转发重定向总结
一.请求重定向:
1.原始方式
response.setStatus(302);
response.setHeader("Locaton","/xxxxxx");
2.快捷方式
response.sendRedirect("/xxxx");
*3.额外的方式
response.setHeader("refresh","0;url=/xxxx");
<c:redirect>
二、请求转发
1.
ServletContext.getRequestDispatcher().forward();
2.
request.getRequestDispatcher().forward();
3.
pageContext.forward("");
<jsp:forward>
三、请求包含
1.
ServletContext.getRequestDispatcher().include()
2.
request.getRequestDispatcher().include()
3.
<%@ include file=""%>
4.
pageContext.include("/index.jsp");
5.
<jsp:include/>
6.
<c:import/>