GenericServlet implements ServletConfig interface which means all the interface functions can be invoked from init() function of GenericServlet. Given this context, why does the Servlet container sends ServletConfig object to init() method? I would also like to know if the ServletConfig object that is passed to GenericServlet.init(ServletConfig) different from GenericServlet object.
Regards,
Ravi
The
GenericServletimplements theServletConfigmethods by simply delegating to the config object passed to the init method. So it implementsServletConfigsimply for convenience – it then simply delegates. So instead of callinggetServletConfig().getInitParameter()you can callgetInitParameter()