Servlet life cycle

Servlet life cycle describes how and when a servlet object is created and initialzed, how it processes requests and how and when it is destroyed by the server. Servlet life cycle is defined by javax.servlet.Servlet interface. Life cycle methods of Servlet interface: init(): This method is invoked by the web server only once, just after […]


How a Servlet is defined?

A servlet class can be defined by directly implementing the Servlet interface or by extending a helper class javax.servlet.GenericServlet provided by servlet API. It is an abstract class, which implements Servlet interface and defines all its methods except service() i.e. In its sub class, an application programmer need to define only the service method. Following […]