jQuery in Action, 3rd edition
The moose likes Servlets and the fly likes Lifecycle of Servlet Context Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Servlets
Bookmark "Lifecycle of Servlet Context" Watch "Lifecycle of Servlet Context" New topic

Lifecycle of Servlet Context

Hue Cheng

Joined: Aug 15, 2003
Posts: 8
What is the lifecycle of a servlet context?
Would its lifetime be exactly the same as servlet?
I'm wondering when and how the methods
ContectInitialized and ContextDestroyed of
ServletContextListener will be called,
would anyone please explain them to me?
Thank you!
Malhar Barai
Ranch Hand

Joined: Aug 17, 2001
Posts: 399
ServletContext get destroyed as soon as the Web Server shuts down..

Malhar Barai
SOA & Java Book
Hue Cheng

Joined: Aug 15, 2003
Posts: 8
Thank you.
Then do you mean lifetime of a servlet context = lifetime of servlet?
William Brogden
Author and all-around good cowpoke

Joined: Mar 22, 2000
Posts: 13037
I think the Servlet Context exists outside the lifetime of a servlet since there may be many servlets sharing a context in a single "web application." Read the JavaDocs for the javax.servlet.ServletContext interface for the authoritative information.
I agree. Here's the link: http://aspose.com/file-tools
subject: Lifecycle of Servlet Context
It's not a secret anymore!