The container will always call init(ServletConfig) before placing a servlet in service. init() is a convenience method provided in GenericServlet.
The init(ServletConfig) of GenericServlet stores the ServletConfig object it receives from the servlet container for later use. It then makes a call to init().
If you override both, - container still calls the life cycle method init(ServletConfig) - you are responsible for calling super.init(config) - init() will not be called, unless your implementation of init(ServletConfig) calls it.
Joined: Aug 15, 2004
thanx for pointing out sheldon. i just put it in reverse order. and paste the statement in the doc below. i am editing it.
Moreover, documentation says:
init() is a convenience method which can be overridden so that there's no need to call super.init(config).
Instead of overriding init(ServletConfig), simply override this method and it will be called by GenericServlet.init(ServletConfig config). The ServletConfig object can still be retrieved via getServletConfig() [ September 15, 2004: Message edited by: adeel ansari ]