Context is stored at the application level scope where as request is stored at page level.If you use an absolute path(full path) such as (“http://www.computerhope.com/jargon/a/index.jsp”), there is no difference.

If you use relative path, you must use HttpServletRequest.getRequestDispatcher(). ServletContext.getRequestDispatcher() doesn’t allow it.

RequestDispatcher dispatcher = 
        request.getRequestDispatcher("index.jsp");
    dispatcher.forward( request, response ); 

Will forward the request to the page http://example.com/myapp/subdir/index.jsp

Comments are closed.