Difference between ServletRequest.getRequestDispatcher and ServletContext.getRequestDispatcher
- request.getRequestDispatcher(“url”) means the dispatch is relative to the current HTTP request.
Example code: RequestDispatcher reqDispObj = request.getRequestDispatcher("/home.jsp");
-
- getServletContext().getRequestDispatcher(“url”) means the dispatch is relative to the root of the ServletContext.
Example code:RequestDispatcher reqDispObj = getServletContext().getRequestDispatcher("/ContextRoot/home.jsp");
No comments:
Post a Comment