This week's book giveaways are in the Java EE and JavaScript forums.
We're giving away four copies each of The Java EE 7 Tutorial Volume 1 or Volume 2(winners choice) and jQuery UI in Action and have the authors on-line!
See this thread and this one for details.
The moose likes Servlets and the fly likes static blocks in servlels Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of The Java EE 7 Tutorial Volume 1 or Volume 2 this week in the Java EE forum
or jQuery UI in Action in the JavaScript forum!
JavaRanch » Java Forums » Java » Servlets
Bookmark "static blocks in servlels" Watch "static blocks in servlels" New topic
Author

static blocks in servlels

manasa teja
Ranch Hand

Joined: May 27, 2002
Posts: 325
Sometime back, somewhere, I read that, we are not supposed to use static blocks in servvlets. Is it because, teh static blocks gets executed during initiaon.
Can someone explain the reason with example.
ram


MT
William Brogden
Author and all-around good cowpoke
Rancher

Joined: Mar 22, 2000
Posts: 12769
    
    5
I know of no reason to avoid static initialization blocks in servlets and I have used them occasionally.
Bill
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
 
subject: static blocks in servlels