Number Of Page View:100,000+/Months
LOGIN |New User


What is Servlet chaining?
Servlet Chaining is a phenomenon wherein response Object (Output) from first Servlet is sent as request Object (input) to next servlet and so on. The response from the last Servlet is sent back to the client browser.
In Servlets, there are two ways to achieve servlet chaining using javax.servlet.RequestDispatcher:

   1. Include:

    RequestDispatcher rd = req.getRequestDispatcher("Servlet2");
      rd.include(req, resp);

   2. Forward, where req is HttpServletRequest and resp is HttpServletResponse:

    RequestDispatcher rd = req.getRequestDispatcher("Servlet3");
      	rd.forward(req, resp);

Posted By: Name:Rajesh Kr URL: What is Servlet chaining?