Meaningless Drivel is fun!
The moose likes Servlets and the fly likes Servlet Context Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Servlets
Bookmark "Servlet Context" Watch "Servlet Context" New topic

Servlet Context

Ranch Hand

Joined: Nov 22, 2008
Posts: 18944
What is a Servlet Context ?? Where do u specify it?
Matt Midcap

Joined: Jan 07, 1999
Posts: 440
Basically a ServletContext is used to maintain a state for a web application (non-specific user). Much in the same way a Session object is used to maintain state of a client on a server.
I would recommend looking at a book called Professional Java Server Programming (ISBN 1-861002-77-7) for more information regarding where to specify, configure, initialize, access it, etc. It's an involved process but is very cool and worth while learning it if you're doing this type of programming.

Best Regards,<br />Matt Midcap
Tony Alicea

Joined: Jan 30, 2000
Posts: 3226
I agree; that is a good book...

Tony Alicea
Senior Java Web Application Developer, SCPJ2, SCWCD
pollai mandala

Joined: Jun 16, 2000
Posts: 17
if u want to know about servlet context just for awareness,
then its ok.But it is of troublesome when we use it in real
time applications.
It is not supported now .(sinnce javaweserver2.0 coz' its a dangerous (ref: jsdk docs) class)

William Brogden
Author and all-around good cowpoke

Joined: Mar 22, 2000
Posts: 13036
Your statement about ServletContext
"it is not supported now .(sinnce javaweserver2.0 coz' its a dangerous (ref: jsdk docs) class)"
it totally off the wall.
The ServletContext is how your servlet finds out about various Application level parameters and is an integral part of the 2.2 Servlet spec.
In a JavaServer Page, the "application" object is a ServletContext.
You may have been thinking of HttpSessionContext which is now deprecated for security reasons.
I agree. Here's the link:
subject: Servlet Context
jQuery in Action, 3rd edition