Servlet's init() and destroy() method and constructors
Author and ninkuma
posted 5 years ago
The container. (E.g. Tomcat, Weblogic, and so on)Shrikant Deshpande wrote:Who calls Servlet's init() and destroy() method?
They get called just like any other method. Whne they get called is covered in the Servlet Spec -- when the servlet isplaced into service, and when it is removed from service.How and when it gets called?
Yes, if you have something meaningful to do when the servlet is taken out of service.Can we override destroy() method?
Yes, but it's not a customary or useful thing to do.Can we have constructor inside servlet class which extends from HttpServlet or GenericServlet?