postheadericon Difference between GenericServlet and HttpServlet

GenericServlet:


  • As name says it Generic in nature. Means GenericServlet is protocol-independent.
  • import  javax.servlet.servlet package
  • super class of GenericServlet are java.lang.Object and it implements three interfaces Servlet, ServletConfig and java.io.Serializable
  • To write a generic servlet, override the abstract service().
  • GenericServlet  lifecycle methods use ServletConfig interface.
  • GenericServlet implements the log() from ServletContext interface.
  • Prototype:
    • public abstract class GenericServlet extends java.lang.Object implements Servlet, ServletConfig, java.io.Serializable
  • Example:

Total Pageviews

© BipinRupadiya.com. Powered by Blogger.