Site icon TestingDocs.com

GenericServlet Class

Overview

GenericServlet is a pre-defined abstract class provided by the Java Servlet API. GenericServlet defines protocol independent servlet. The class is defined in the javax.servlet package.

GenericServlet Class

GenericServlet class is an abstract class and the container does not create any object for this class. The class implements the following interfaces:

The Servlet interface defines methods that all servlets must implement. ServletConfig defines a servlet configuration object used by a servlet container to pass the information to the servlet during the initialization phase.

GenericServlet provides simple implementations for most of the methods in the Servlet and the ServletConfig interface.  It contains the following abstract method:

service(req, res)

This method is not implemented. We can extend GenericServlet class to create a servlet.
The subclass should override and provide an implementation for the service() method.

Java Tutorials

Java Tutorial on this website:

https://www.testingdocs.com/java-tutorial/

For more information on Java, visit the official website :

https://www.oracle.com/java/

Exit mobile version