1. <jsp:forward page="<%= nextPage%>" />
可以传递参数!
2. javax.servlet.http.HttpServletResponseWrapper
|_ void sendRedirect(String location) throw IOException
不能传递request,可以通过session等传递参数
3. From
ServletContext.getRequestDispatcher(java.lang.String),
ServletContext.getNamedDispatcher(java.lang.String),
ServletRequest.getRequestDispatcher(java.lang.String)RequestDispatcher object, and you can use the method
get
void forward( request,response) throws ServletException, java.io.IOException
可以传递request 和 response
比如使用如下方法:
RequestDispatcher rd=request.getRequestDispatcher("index.jsp");
rd.forward(request, response);
此方法可以用于搜索等。