Difference in HttpServlet and GenericServlet

javax.servlet.GenericServlet

Signature:

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.

javax.servlet.http.HttpServlet

Signature:

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.

Posted

in

,

by

Tags:


Related Posts

Comments

Leave a Reply

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

Discover more from Jitendra Zaa

Subscribe now to keep reading and get access to the full archive.

Continue Reading