Difference in HttpServlet and GenericServlet

Author posted by Jitendra on Posted on under category Categories JAVA, Servlet and tagged as Tags with Leave a comment on Difference in HttpServlet and GenericServlet

What is the basic Difference in HttpServlet and GenericServlet



public abstract class GenericServlet extends java.lang.Object implements Servlet, ServletConfig, java.io.Serializable
  1. GenericServlet defines a generic, protocol-independent servlet.
  2. GenericServlet gives a blueprint and makes writing servlet easier.
  3. GenericServlet provides simple versions of the lifecycle methods init and destroy and of the methods in the ServletConfig interface.
  4. To write a generic servlet, it is sufficient to override the abstract service method.



public abstract class HttpServlet extends GenericServlet implements java.io.Serializable
  1. HttpServlet defines a HTTP protocol specific servlet.
  2. HttpServlet gives a blueprint for Http servlet and makes writing them easier.
  3. HttpServlet extends the GenericServlet and hence inherits the properties of GenericServlet.

Related posts

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.