group-icon
Java Developers
Group for Java developers and programmers. Ask questions and get answers related to Java programming
271 Members
Join this group to post and comment.
Soubhik Maji
Soubhik Maji
Computer Science
15 Jan 2019

J2EE Web Server web container Servlet lifecycle

1.Web server is a program that resides in the server that serves files in form of web pages to the client requesting it (Apache Tomcat)


2.The client explicitly mention the address of the server and also the port to access http service 


3.Web container/Servlet Container- is that component of server that interacts with the servlet ,does URL mapping to particular servlet (so helps with dynamic web pages based on input),manages servlets life cycle. (Catalina servlet container of Apache Tomcat)

Or

 A servlet container is a software program to load ,instantiate and execute servlet  .



Servlet 


4.servlet is an interface defined in javax.servletpackag


5.three essential methods -init() , service and destroy 


6.first servlet is loaded in servlet container dynamically 

 

7.init() method of servelt is called by container 


8.

Container invokes 

I.Service method to process http request I.e read the data in the request and formulate a response .The servlet remains in the container and can handle other requests .(servlet handles multiple threads by creating multiple threads executing service method over single instance of servlet)


II.The service method in turn calls doget() dopost()  put and delete..



9.Response is send to current location by web server. 


10.destroy()-Servlet object should be destroyed  and releases resources