• 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 Loading-Attributes

 
Ranch Hand
Posts: 73
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I did not understand why u cannot let one servlet in particular to run first(by giving highest load-on-start value in DD -in that case the servlet gets loaded and initialized even before the 1st request comes in) and put code inside that servlet to set servletcontext attributes(for entire web app)??HFS doesnt state why it is a wrong approach(ref page-164)
 
Cowgirl and Author
Posts: 1589
5
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Howdy -- good question. While you can certainly do it *technically*, I think it's more of a design approach that's the problem--that you would have a dependency on configuring that servlet to load first, and it's kind of an arbitrary way to initialize those things. If your application changes, you'd always have to remember to have one servlet configured to do that, and from an OO standpoint, it might not be the most cohesive to pick one servlet and designate it as The One To Do That Lookup Work. Whereas a listener might make a better design choice...

So, you're right, Sanday, that you could do this. It's a design issue that we were complaining about, but we should have been more clear in explaining WHY we said it like that.

cheers,
Kathy
 
Sandya Bhaskara
Ranch Hand
Posts: 73
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
one more question--page 596 HFS-no dumb questions-it says u can save resources by not loading servlets that are rarely used in advance..but even if 1 client makes a request that results in loading of a particular servlet which is very rarely used it stays loaded till the web app goes down....isn't it a disadvantage???..i mean wouldn't it have been good had there been someway to unload the servlet without bringing the app down
 
It is an experimental device that will make my mind that most powerful force on earth! More powerful than this tiny ad!
a bit of art, as a gift, that will fit in a stocking
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic