Originally posted by rathi ji:
"init method will be executed immediately after loading and instantiation of the servlet class takes place"
Instantiation is creating object. What exactly loading is? What JVM does while loading?
Thanks.
a servlet is not loaded until it gets the first request from the user. then the init is called and it is not called anymore.and in the same way destroy is called when the servlet is destroyed or removed from the tray..
if you have a servlet and in the web.xml where you define the behavious of the servlet..you specify that it should load on startup of the application.Then what is does is ..it loads the servlet and off course calls the init() as soon as the application is loaded irrespective of any used requests.
cheers!