Issue
When I decompile the GenericServlet and check the init() , I see the following code .
public void init(ServletConfig servletconfig)
throws ServletException
{
config = servletconfig;
init();
}
public void init()
throws ServletException
{
}
What is the init method actually doing here ? Am I missing something ?
Solution
From the javadoc:
/**
*
* A convenience method which can be overridden so that there's no need
* to call <code>super.init(config)</code>.
*
* <p>Instead of overriding {@link #init(ServletConfig)}, simply override
* this method and it will be called by
* <code>GenericServlet.init(ServletConfig config)</code>.
* The <code>ServletConfig</code> object can still be retrieved via {@link
* #getServletConfig}.
*
* @exception ServletException if an exception occurs that
* interrupts the servlet's
* normal operation
*
*/
So it does nothing and is just a convenience.
Answered By - bert