top button
Flag Notify
    Connect to us
      Site Registration

Site Registration

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

+1 vote
462 views
Why do we need to call super.init(config) in the init method of a servlet?
posted Nov 24, 2015 by Joy Nelson

Share this question
Facebook Share Button Twitter Share Button LinkedIn Share Button

1 Answer

0 votes

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

answer Nov 25, 2015 by Karthick.c
...