by Dinesh Thakur Category: introduction to Servlet

There is a possibility of developing ‘n’ types of servlets, like httpservlet, ftpservlet, smtpservlet etc. for all these protocol specific servlet classes GenericServlet is the common super class containing common properties and logics. So, GenericServlet is not a separate type of servlet.

As of now Servlet API is giving only one subclass to GenericServlet i.e HttpServlet class because all web servers are designed based on the protocol http.

                               Type of Servlet
Generic servlets extend javax.servlet.GenericServlet - It is protocol independent servlet. Generic Servlet is a base class servlet from which all other Servlets are derived. Generic Servlet supports for HTTP, FTP and SMTP protocols. It implements the Servlet and ServletConfig interface. It has only init() and destroy() method of ServletConfig interface in its life cycle. It also implements the log method of ServletContext interface.

HTTP servlets extend javax.servlet.HttpServlet - HTTPServlet is HTTP dependent servlet. The HTTP protocol is a set of rules that allows Web browsers and servers to communicate.  When Web browsers and servers support the HTTP protocol, Java-based web applications are dependent on HTTP Servlets.HttpServlet is Extended by Generic Servlet. It provides an abstract class for the developers for extend to create there own HTTP specific servlets.



About Dinesh Thakur

Dinesh ThakurDinesh Thakur holds an B.SC (Computer Science), MCSE, MCDBA, CCNA, CCNP, A+, SCJP certifications. Dinesh authors the hugely popular blog. Where he writes how-to guides around Computer fundamental , computer software, Computer programming, and web apps. For any type of query or something that you think is missing, please feel free to Contact us.