-1

After converting JSP into servlet it has to call init method but why it is calling jspinit method?

Sotirios Delimanolis
  • 274,122
  • 60
  • 696
  • 724
Kumaran Palani
  • 217
  • 1
  • 3
  • 6

2 Answers2

1

There are two methods in order to separate the JSP framework concerns from the page creator's concerns. jspInit is what the creator of the JSP overrides, it allows initialization code to be added without overriding the servlet's init method (which would have the risk of overruling any initialization code created by the framework if the overriding method failed to call the superclass' version).

Nathan Hughes
  • 94,330
  • 19
  • 181
  • 276
0

The jspInit() method is invoked when the JSP page is initialized. It is the responsibility of the JSP implementation (and of the class mentioned by the extends attribute, if present) that at this point invocations to the getServletConfig() method will return the desired value. A JSP page can override this method by including a definition for it in a declaration element. A JSP page should redefine the init() method from Servlet.

Reference : 1

codeMan
  • 5,730
  • 3
  • 27
  • 51