Difference between RequestDispatcher and sendRedirect

  Forward() SendRediret() When we use forward method request is transfer to other resource within the same server for further processing. In case of sendRedirect request is transfer to another resource to different domain or different server for futher processing. In case of forward Web container handle all process internally and client or browser is … Continue reading Difference between RequestDispatcher and sendRedirect

Advertisements

Difference between request.getRequestDispatcher and servletContext.getRequestDispatcher

First we will look at the differences between the two. request.getRequestDispatcher(String path) path need not begin with '/'. If path starts with '/' then this also works like servletContext.getRequestDispatcher(String path)  This can accept path relative to request path or relative to context root path. Ex: 1 In request, http://localhost:8080/RequestDispatcherExampleApp/s1/page1.jsp Context root is /RequestDispatcherExampleApp Relative path to request is /RequestDispatcherExampleApp/s1/ … Continue reading Difference between request.getRequestDispatcher and servletContext.getRequestDispatcher