What is Web Container in Java?

What is Web Container in Java?

Web Container is an java application that controls servlet. Servlet do 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 contain a servlet, server sends that request to 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().

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

Ebook Download
View all
Learn
View all