dcsimg

Why do we need to call super.init(config) in the init method of a servlet?

Alex Chaffee

Just do as you're told and you won't get hurt! :-)

Because if you don't, then the config object will get lost. Just extend HttpServlet, use init() (no parameters) and it'll all work ok.

From the Javadoc: init() - A convenience method which can be overridden so that there's no need to call super.init(config).