GenericServlet class in java

GenericServlet class: GenericServlet class implements the Servlet and ServletConfig interfaces. GenericServlet is protocol-independent. It not provides the implementation of service method. public abstract class GenericServlet implements Servlet, ServletConfig GenericServlet class is in javax.servlet package (javax.servlet.GenericServlet). Methods of GenericServlet class: 1. init(ServletConfig config): It is used to initialize the servlet. This method is called only once by the web container when it loads the servlet. Syntax: public void … Read more

Servlet interface in java

Servlet interface: The Servlet interface contains the common methods for all servlets i.e. provides the common behavior for all servlets. public interface Servlet Servlet interface is in javax.servlet package (javax.servlet.Servlet). Methods of servlet interface: 1. init(ServletConfig config): It is used to initialize the servlet. This method is called only once by the web container when it … Read more