Servlet things every Java Developer must know — Servlet, Container, Filter, and Listener

--

Hello everyone. In this article, we will be looking at what is the difference between a Web Server and a Servlet container first. Then we will deep dive into the Servlet Container and Servlet. We will also see about the life cycle of Servlet, Servlet Filter, and Listener.

Servlets are very low level, so they are not often suitable to be used raw. But every framework that Java has — Spring REST, Spring WebMVC, DropWizard, Play, and more — is all built on Servlets. Hence it is very important for every Java developer to know these things as these are the fundamentals upon which Java EE is built.

Image Source: https://siliconvalleygazette.com/posts/different-containers-available-in-servlet.png

What is a Web Server?

A web server is a simple server to serve static content. It does not support dynamic content and it only supports static resources, like images and HTML files.

Apache Web Server is the most popular web server, followed by Microsoft IIS Server.

As you see in the diagram, users request a resource and the server provides the content. These are not popular nowadays as we have moved to the cloud and we have…

--

--

Dineshchandgr - A Top writer in Technology
Javarevisited

Principal Software Engineer and Technical Lead focussed on Backend Engineering who likes to upgrade the tech skills and share knowledge to the community