What is the need of super.init(config) in servlets?

Showing Answers 1 - 6 of 6 Answers

siva

  • Sep 26th, 2005
 

This will call the super class init method to initialize the object  by config.

  Was this answer useful?  Yes

javamatrix

  • Nov 9th, 2005
 

basically super.init() method should be used whenever u are overriding the init method....else i dont think there is any necessity.....

  Was this answer useful?  Yes

javamatrix

  • Nov 9th, 2005
 

basically super.init() method should be used whenever u are overriding the init method....else i dont think there is any necessity.....

  Was this answer useful?  Yes

naresh

  • Jan 30th, 2006
 

if u invoke the init()then u dont worry about the super.init(config) in servlet butif u override the init(ServletConfig sc) then u have to call the super.init(config) in servletbecause the Parent Class init() cotains some CODE to execute .that must be executed ,So we should call the super.init(config) in servletif u want to see the code U can becoz it is OpenSource.

  Was this answer useful?  Yes

Amit Saini

  • Dec 15th, 2006
 

As we know, we override the init() method1Genericservlet have init() method without argument 2 servlet Interface have init() method with argumentInit(ServletConfig object)& we know super is use the invoke the method of supper callSo when we write supper.init(),its overrider the init() method from the GernericServlet classRight..Amit saini

  Was this answer useful?  Yes

when i m providing init method in our servlet something like that public void init() throws Exception()
{
//do something
}
then webcontainer search for the init method to call n it find this in our servlet and  didnt provide all the things regarding to settingup of servlet in this case servlet is going to fail thats why v should provide the super.init() that is call the http servlet init method. 

  Was this answer useful?  Yes

Give your answer:

If you think the above answer is not correct, Please select a reason and add your answer below.

 

Related Answered Questions

 

Related Open Questions