This section define the concept of java servlet.
Servlets are small java programs run on web server. You can say these are server side programming. It works between client request and the server. Request is generated by the web browser or HTTP client and database for server, which is handled by the servlet.
We use javax.servlet and javax.servlet.http packages for writing servlets. These packages provide interfaces and classes for our servlets. When you writing any servlets, its required to implements the Servlet interface which defines the lifecycle methods. For generic service you can use or extend the GenericServlet class. For handling HTTP-specific service, HttpServlet class gives you methods, such as doGet and doPost.
Using servlets web developers can create fast and efficient server side applications and can run it on any servlet enabled web server. Servlet runs entirely inside the Java Virtual Machine. Since the servlet runs on server side so it does not depend on browser compatibility.
CGI vs Servlet - Advantages of Servlets over the CGI-
Servlet Architecture view - Following picture is overview of Servlets. It is showing the hierarchy of inheriting the Servlet interface. The main abstraction of Servlet API is the Servlet interface. Servlets implements this interface directly or by extending class that implements it.
Ask your questions, our development team will try to give answers to your questions.