Posts

Showing posts with the label Servlet Lifecycle

Servlet Lifecycle

Image
Servlet Life Cycle The life cycle of the servlet is controlled by the S ervlet container . Basically there are three methods in servlet lyfe cycle which servlet calls 1.      init()-  This method is called to initialize  a servlet. In servlet 2.4 specification if you do not call init() method in your servlet program then the container call it implicitly. 2.      service()-  This method is called to execute the business logic written in servlet. This is the method which you must have to override, when you are writing a servlet. 3.      destroy()-  This method is called to finalize the servlet. Note- The servlet call init() and destroy() method only once called during its life cycle. During initialization stage of the Servlet  life cycle , the web container initializes the Servlet instance by calling the  init()  method, passing an object implement...