• 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
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Servlet Initialization

 
Ranch Hand
Posts: 169
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hello All,
When a servlet container is started, it looks for a Deployment Descriptor (DD) file- web.xml.
Is it true that for every registered servlet, the container will instantiate it. Put simply, say I have two servlets: A and B. Only A is registered in the DD web.xml file (no, <load-on-startup> tag). When the container is started, is it that only servlet A is instantiated, or do i need to put <load-on-startup> to make sure the servlet A is instantiated? And, what happens to Servlet B which is not registered in web.xml file? is it also instantiated when s container is started or when it's requested for the first time?

Any help shall be highly appreciated.

Thanks,
Reema
 
Rancher
Posts: 43081
77
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Only the servlets having a load-on-startup will be initialized on startup. The others will be when they are first accessed.

Hm, how would you even access servlets that have no entry in web.xml - are you using the invoker servlet?
 
Reema Patel
Ranch Hand
Posts: 169
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Ulf,
Thanks for the post.

Yes, I'm using the invoker servlet.

Thanks,
Reema
 
A timing clock, fuse wire, high explosives and a tiny ad:
a bit of art, as a gift, the permaculture playing cards
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic