Prev Tutorial Next Tutorial


GenericServlet class Implements Servlet, ServletConfig and Serializable Interfaces. It provides the implementation of all the methods of these Interfaces except the service method. GenericServlet class can handle any type of request so it is protocol Independent. You may create a generic Servlet by inheriting the GenericServlet class and providing the Implementation of the service method.

This is a implemented abstract class for Servlet Interface, have the implementation for all methods of Servlet interface except service method.

Methods of GenericServlet

All methos of Servlet Interface are inherit in GenericServlet class because it Implements Servlet Interface. Following methods are used in GenericServlet.

Example of Servlet by inheriting the GenericServlet class


import javax.servlet.*;
public class GenericServletDemo extends GenericServlet
public void service(ServletRequest req,ServletResponse resp)
throws IOException,ServletException
PrintWriter out=resp.getWriter();
out.print("<b>Example of GenericServlet</b>");

Prev Tutorial Next Tutorial

Download Projects

Google Adsense Advertisements
Free Classified Site – Bedpage

Yahoo Advertisements