What is the Servlet Interface?

The central abstraction in the Servlet API is the Servlet interface. All servlets implement this interface, either directly or, more commonly, by extending a class that implements it such as HttpServlet.Servlets-->Generic Servlet-->HttpServlet-->MyServlet.The Servlet interface declares, but does not implement, methods that manage the servlet and its communications with clients. Servlet writers provide some or all of these methods when developing a servlet.

Showing Answers 1 - 9 of 9 Answers

veeru

  • Sep 8th, 2005
 

Servlet Interface 
This is an Interface which is having all Life cycle methods of Servlet; 
init() 
service() 
destroy()

  Was this answer useful?  Yes

anamika

  • Nov 30th, 2005
 

while writing servlet this the interface you must implement either directly or indirectly by extending either javax.servlet.GenericServlet or javax.servlet.http.HttpServlet class.

This is the interface web-container use to reference servlets, it contains all the life cycle methods of a servlet.

                                  

  Was this answer useful?  Yes

servlet interface is the interface through which we can define servlets for all the servlets......bur since we generally use servlets for http protocol.....so the hierarchy is....

    Servlet<---GenericServlet<----HttpServlet (for http protocol)

  Was this answer useful?  Yes

trinadhd

  • Jul 7th, 2009
 

It is nothing but an interface which contains set of method names (prototypes).
Those are called servlet life cycle methods.
init(ServletConfig)
getServletConfig()
service(SeveletRequest , ServletResponce)
distroy()

The class whch says itself a servlet class, must implement these methods first (directly or indirectly). These methods will be called by the web container at different states of the life cycle of servlet object ...

  Was this answer useful?  Yes

Give your answer:

If you think the above answer is not correct, Please select a reason and add your answer below.

 

Related Answered Questions

 

Related Open Questions