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).

0 Comments  (click to add your comment)
Comment and Contribute

 

 

 

 

 


(Maximum characters: 1200). You have 1200 characters left.

 

 

About | Sitemap | Contact