by Dinesh Thakur Category: introduction to Servlet

1. Servlet container loads our servlet class from WEB-INF\classes folder of deployed web application.

2. Servlet container instantiates (object creation) our servlet class object as Class.forName (“FolderName”).newInstance (); 

             Class.forName (“FolderName”)      // loads our servlet class   

             newInstance ()       // creates object for the loaded class DateSrv    

3. During instantiation process the 0-param constructor of our servlet class executes.

4. Servlet container creates one servlet config object for our servlet class object.

5. Servlet container calls init (-) life cycle method having servlet config object as argument value on our servlet class object.               

Note: 1 to 5 steps completes instantiation and initialization on our servlet class object.

6. Servlet container calls next life cycle method service (-,-) on our servlet class object. This will process the request and generated response goes to browser window as web page through web server.

Other than First Request

 Servlet container checks the availability of our servlet class object.

1. If available, servlet container calls service (-,-) (public) on existing object of our servlet class to process the request and this response goes to browser window.

2. If not available, servlet container performs all operations of first request.

About Dinesh Thakur

Dinesh ThakurDinesh Thakur holds an B.C.A, MCSE, MCDBA, CCNA, CCNP, A+, SCJP certifications. Dinesh authors the hugely popular blog. Where he writes how-to guides around Computer fundamental , computer software, Computer programming, and web apps. For any type of query or something that you think is missing, please feel free to Contact us.