• Post Reply Bookmark Topic Watch Topic
  • New Topic

Loading of Servlet?

 
ankur rathi
Ranch Hand
Posts: 3830
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
"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.
 
Bear Bibeault
Author and ninkuma
Marshal
Posts: 65530
108
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Before any instance of a class can be created, its class definition must be loaded by the class loader.

Not really a servlet topic.
[ November 28, 2005: Message edited by: Bear Bibeault ]
 
Rahul Bhattacharjee
Ranch Hand
Posts: 2308
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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!
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!