Wednesday, November 30, 2011

The javax.servlet.Servlet interface

  ?

init() :     

          public void init(ServletConfig config) throws ServletException

          It is executed only once after the instantiation of servlet to perform initialization
          activities. Web Container doesnot place the servlet into the context if the method
          throws any exception or if the method execution is not completed in the specified
          time.

service() :
            
          public void service(ServletRequest  req,ServletResponse res) throws ServletException,
                                                                                                                        IOException

          This method will be executed for every request. The request and response objects
          created for this request are eligible for garbage collection once the service method
          execution completes succesfully.

destroy() :
  
            public void destroy()
            
            This method is executed only once just before  taking servlet out of  service to
            perform clean up activities.

No comments:

Post a Comment