I am confused by the 2 init() methods - one with servlet config and one without parameter. which is part of the life cycle methods.
HFS book / sun website says ..it will call init() and we can put some init code there . in Sun's web site , they also have some initialization example. Plus there is no super.init() in that method.
But searching on the net , for example , www.roseindia.net , they have quoted init(servletconfig) method as part of initialiation which has super.init(config).If i start a new servlet in ORacle Jdeveloper , a init(Servletconfig) method is automatically created with super.init(config) method . There is no init() method .
Can someone clarify which method is part of servlet life cycle and bit more on this process.
The init(ServletConfig) is the life-cycle method. This method is defined in the Servlet API. The another init() is a conveniance method which is definded in GeneriServlet Abstract class. It not part of life cycle. The init() method is called by the init(ServletCofig) method as per the Servlet documentation. If the vendor directly developing the Servlet class which does not extend the GenericServlet, but implement the API interface contarct, then it is not necessary to them to define the init() conveniance method as it is not part of contract. Also it is not necessary to implement the ServletConfig interface for the base class of the servlet as GenericServlet does.