This week's book giveaway is in the Android forum.
We're giving away four copies of Learning Java by Building Android Games and have Jean-Marcel Belmont on-line!
See this thread for details.
Win a copy of Learning Java by Building Android Games this week in the Android 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 all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Liutauras Vilda
  • Bear Bibeault
  • Jeanne Boyarsky
  • Tim Cooke
Sheriffs:
  • Knute Snortum
  • Junilu Lacar
  • Devaka Cooray
Saloon Keepers:
  • Ganesh Patekar
  • Tim Moores
  • Carey Brown
  • Stephan van Hulst
  • salvin francis
Bartenders:
  • Ron McLeod
  • Frits Walraven
  • Pete Letkeman

Servlet Loading-Attributes  RSS feed

 
Ranch Hand
Posts: 73
  • Mark post as helpful
  • send pies
  • 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
Rancher
Posts: 1589
5
  • Mark post as helpful
  • send pies
  • 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
  • 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
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!