Hello,
init() is mainly implemented by the developer to get the initialization parameters.
public void init(){
getServletConfig().getInitParameter("parameter1");
}
.......web.xml......
<servlet>
<servlet-name>.......
<init-param>
<param-name>parameter1</param-name>
<param-value>first</param-value>
</init-param>
</servlet>
.......................
The above can not be done using static block or anything else.
Conatiner calls init(ServletConfig) method and passes the initialization parameters by wrapping to ServletConfig object....which in turn calls
init() method implemented by developer.Here you can access the config object by getServletConfig() method.
Regards
Afroz Ahmed
SCJP(1.4)
SCWCD...on track