Win a copy of Microservices Testing (Live Project) this week in the Spring forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Tim Cooke
  • Ron McLeod
  • Jeanne Boyarsky
  • Paul Clapham
Sheriffs:
  • Liutauras Vilda
  • Henry Wong
  • Devaka Cooray
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • Al Hobbs
  • Carey Brown
Bartenders:
  • Piet Souris
  • Mikalai Zaikin
  • Himai Minh

Loading of Servlet?

 
Ranch Hand
Posts: 3852
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
Sheriff
Posts: 67650
173
Mac Mac OS X IntelliJ IDE jQuery TypeScript Java iOS
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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 ]
 
Ranch Hand
Posts: 2308
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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!
 
reply
    Bookmark Topic Watch Topic
  • New Topic