The only difference is that the pathname specified in 'ServletRequest.getRequestDispatcher' does not require a leading slash, so you can use it with a relative URL. 'ServletContext.getRequestDispatcher' requires a leading slash.
Example:
RequestDispatcher dispatcher=request.getRequestDispatcher("Coreservlet");
(or)
RequestDispatcher dispatcher=request.getRequestDispatcher("/Coreservlet");
But,
RequestDispatcher
dispatcher=getServletContext().getRequestDispatcher
("/Coreservlet");
No comments:
Post a Comment