giri
giri

Reputation: 27229

What does it mean "jsp page overrides two container callbacks"?

I read the sentence "jsp page overrides two container callbacks using jspInit() and jspDestroy()" I like to know what are callbacks

Can anybody elaborate on this?

Thanks..

Upvotes: 1

Views: 372

Answers (1)

Tendayi Mawushe
Tendayi Mawushe

Reputation: 26128

You might find this question and answer useful for the general concept of a callback: What is a callback function?

This is a typical way to implement a framework (such as JSP for example). The framework manages a complex environment for you such as web server (a container in JSP speak). In order to tell the framework/container what to do do for you at various points you implement some callback functions which the framework calls at the appropriate time. In your example container manages the JSP for you. The jspInit() method is invoked when the JSP page is initialized so you could put any setup code for your in there. The jspDestroy() method is invoked when the JSP page is about to be destroyed, so you could put any tear down code for your JSP in there.

Upvotes: 2

Related Questions