What is Web Container in Java?

What is Web Container in Java?

 
Web Container is a java application that controls servlet. Servlet does not have a main() method, So they require a container to load them.
 
Container is a place where servlet gets deployed.
 
When a client sends a request to web server that contains a servlet, the server sends that request to the container rather than to servlet directly. Container then finds out the requested servlet and pass the Http Request and response to servlet and loads the servlet methods i.e. doGet() or do Post().
 
An example of a web container is Tomcat.
 
Diagrams to show the request made by the client to the server and response received by the client.
 
1. Request made by client to server
 
image1.jpg
 
2. Response received  by client
  
image2.jpg
Next Recommended Reading Youtube Downloader In Java