請求轉發request.getRequestDispatcher("").forward()與PageContext.forward("");有什么區別呢?
請求轉發request.getRequestDispatcher("").forward()與PageContext.forward("");有什么區別呢?
請求轉發request.getRequestDispatcher("").forward()與PageContext.forward("");有什么區別呢?
2015-10-28
舉報
2015-12-17
RequestDispacher,forward method taking request & response as parameter & while getting request dispatcher we are giving path for forward resource,
RequestDispacher rd = request.getRequestDispacher("/resource.jsp");rd.forward(request,response);
and while forwarding through PageContext we are giving resource path to parameter of forward method,
PageContext.forward("/resource.jsp");
we can use RequestDispacher in Servlet as well as Jsp
but PageContext we can use in only jsp.
2015-12-17
RequestDispatcher.forward() and PageContext.forward() are effectively the same. ?PageContext.forward is a helper method that calls the RequestDispatcher method.(forward)