GenericServlet has one of init method as :
void init(ServletConfig config)
and also GenericServlet implements da ServletConfig interface.
Spec says " The container initializes the
servlet instance by calling the init method of the Servlet interface with a
unique (per servlet declaration) object implementing the ServletConfig interface."
My questions are :
- "What is the need/use of GenericServlet implementing ServletConfig itself , as it is the responsibility of web-container to pass config-Object to init()."
( GenericServlet IS-A ServletConfig sounds weird to my ears )
- As GenericServlet implements ServletConfig , any subclass of it 'll inherit methods in interface ServletConfig too. So , suppose i subclass GenericServlet , and in some method of this subclass i call some method of ServletConfig , say i call getSevletContext() . In this case " Do GenericServlet class have some of its own implementation of getServletContext() , or does it internally calls the same method upon ServletConfig passed in init() ? "
( as reference to original ServletConfig passed in init() is stored )
------------------
Gagan (/^_^\) SCJP2
Die-hard JavaMonk -- little
Java a day , keeps u going .