Types of Servlets

Types of Servlets


Posted in : Servlet Posted on : October 29, 2010 at 5:25 PM Comments : [ 0 ]

In this tutorial you will learn different types of servlets

Servlet types

There are mainly two types of servlets -

  1. Generic Servlet - Generic servlet is protocol independent servlet. It implements the Servlet and ServletConfig interface. It may be directly extended by the servlet. Writing a servlet in in GenericServlet is very easy. It has only init() and destroy() method of ServletConfig interface in its life cycle. It also implements the log method of ServletContext interface.

Servlet Hierarche

  1. Http Servlet - HttpServlet is HTTP (Hyper Text Transfer Protocol ) specific servlet. It provides an abstract class HttpServlet for the developers for extend to create there  own HTTP specific servlets. The sub class of HttpServlet must overwrite at least one method given below-
  2. doGet()

    doPost()

    doPost()

    doTrace()

    doDelete()

    init()

    destroy()

    getServiceInfo()

There is no need to overrride service() method. All the servlet either Generic Servlet or Http Servlet passes there config parameter to the Servlet interface.

Go to Topic «PreviousHomeNext»

Your Comment:


Your Name (*) :
Your Email :
Subject (*):
Your Comment (*):
  Reload Image
 
 

 
Tutorial Topics