Web Container
A Web application runs within a Web
container of a Web server. The Web container provides the runtime environment
through components that provide naming context and life cycle management. It
manages the execution of JSP page and Servlet components for the
web applications. Apache Tomcat is the web container that is used to
Implementation for the Java Servlet and JavaServer Pages technologies.
Now lets see what a servlet container does:
- The
servlet container loads the servlet class and calls the init method of the
servlet as soon as the servlet is called for the first time.
- Then this container makes an instance of javax.servlet.ServletRequest and javax.servlet.ServletResponse for each request.
- Then it passes the ServletRequest and ServletResponse objects by invoking the servlet's service method.
- Finally,
it calls the destroy method and unload the servlet class when the
servlet class is to be shut down.
Read more at: