Discussions

Web tier: servlets, JSP, Web frameworks: Difference RequestDispatcher's sendRedirect () And Response's

  1. Any one tell me the diff between RequestDispatcher and Response 's sendRedirect() method?
  2. Up to my knowledge RequestDispatcher has 'forward" and include fecilities. which just makes output, it does not make round trip to browser , where as sendredirect goes to browser, comes back as if typed URL there.
  3. I sincerely suggest you read a good servlet/jsp book to get a good grasp on the fundamentals. The answer to the question you had asked could pretty much be found in any mediocre/high-level servlet/jsp books. BTW, One major difference is you save a network round-trip with RequestDispatcher coz the redirection is done internally within the webserver whereas in SendRedirect, communication is sent to the Browser to redirect its request to the new URI location.