Header Ads

How to call multiple Servlets from a single Servlet?




This section is dedicated to my viewers.Here they can ask question and I will be happy to help or redirect to some page what is best suitable for them. 


Hei Animesh,I am bit confused with Multiple servlet call from a single servlet.I saw your post  http://www.askqtp.com/2012/01/how-to-write-servlet-chain.html Can you explain a bit more?
Regads,
Shan
Hi Shan, Thank you very much for writing me...What I understood from your mail is something like that image.
For that I googled a bit...I got the best answered post here
http://stackoverflow.com/questions/3024949/how-do-i-execute-a-sequence-of-servlets

The way they coded is written below:



public class Populate_ALL extends HttpServlet {
  public void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
     response.setContentType("text/plain");
     request.getRequestDispatcher("/Servlet2").include(request, response);
     request.getRequestDispatcher("/Servlet3").include(request, response);
     request.getRequestDispatcher("/Servlet4").include(request, response);
     //...
  }
}
I hope this will help you further.

Powered by Blogger.