This week's giveaway is in the Android forum.
We're giving away four copies of Android Security Essentials Live Lessons and have Godfrey Nolan on-line!
See this thread 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 Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Java » Servlets
Bookmark "static blocks in servlels" Watch "static blocks in servlels" New topic

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.

William Brogden
Author and all-around good cowpoke

Joined: Mar 22, 2000
Posts: 12761
I know of no reason to avoid static initialization blocks in servlets and I have used them occasionally.
I agree. Here's the link:
subject: static blocks in servlels
Similar Threads
order of execution in java
Where can I call private static method?
Please help with these questions
this Refrence Problem