When init() and Distroy() will be called

  • init() is called whenever the servlet is loaded for the first time into the webserver.it performs certain one time activities which are required during the lifetime of the servlet.It may be some initialisation of variables or a database connection.
  • Destroy will be called whenever the servlet is removed from the webserver. Various resources which are held by the servlet will be released,database connections which were opened will be closed.Later the servlet is destroyed.