In this tutorial you will learn about the sevlet container and its functions
Introduction To Servlet Container
A Servlet Container is compiled executable program, the contains the java servlets. The Container is responsible for loading, initializing, executing and destroying the servlets. When request comes the container maps the request to the servlet, it creates a new thread of the servlet, then the servlet process the request and return the response oject to the container and then container passes it to the server. You can say it makes an interface between the web server and the servlet.
Servlet container
A Container have the capacity of containing many servlets and can handle large number of requests. The Container and the Objects of the container both are multi-threaded. It can handle multiple requests concurrently. All the servlets are managed by servlet container. It is possible for the servlet container to run stand alone or separately.
The Container does the following thing-
- When the request comes at first for the servlet, then it load the servlet, initialize it by calling servlet init() method.
- Makes a thread of the requested servlet
- Makes an instance of ServletRequest and ServletResponse of javax.servlet.*; package
- Passes the ServletRequest and ServletResponse reference variables to the servlet service method
- Take the ServletResponse object from the servlet and passes to the web server
- And finally destroy the reference variables and destroy the servlet when the is shut down.
[ 0 ] Comments