Howdy fellow developers ! After learning OSGi services and components, we will now dive into Servlets.
A Servlet is a class used to extend the capabilities of servers that host applications accessed by means of a request-response programming model. For such applications, Servlet technology defines HTTP-specific servlet classes.
You must be thinking what’s all this jibber-jabber, right? But fret not, in this post, we will try to understand many aspects of Servlets in detail .
What is a Servlet?
A servlet in its very core is a Java class, which can handle network requests (for e.g. HTTP requests). Servlets are usually used to implement web applications. This java class does not have any main() method, only some callback methods.
Servlets run on the java enabled web-server or the application server. They handle requests from the web server, process it, produce the response, then send the response back to the server. This means servlet lives and dies within a web container. A web container is responsible for invoking methods in a servlet. It knows what callback methods a servlet has.
Properties of a Servlet
1. Servlets work on the server-side
2. Servlets are capable of handling requests obtained from the webserver.