17 October 2010
0 What is ServletContext in Java?
ServletContext
The servlet's view of the web application within which the servglet is running is defined by the ServletContext. It also allows access to resources available for it. Within a web server a ServletContext is routed at a specific path.ServletContext Scope
There will be one instance of the ServletContext interface associated with each web application deployed into a container.
In cases where the container is distributed over many virtual machines, there is one instance per web server per virtual machine.
Servlet that exists in a container that were not deployed as part of a web application are implicitly part of the default web application and are contained by the default ServletContext. In a distributed container,the default ServletContext is non-distributable and must only exist on one virtual machine.
ServletContext Attributes
A servlet can bind an object into the context by name.
Any object bound to a context is available to any other servlet which is part of the same application.
Following are the methods of ServletContext which allow access to this functionalty.
- setAttribute()
- getAttribute()
- getAttributeNames()
- removeAttribute()
Subscribe to:
Post Comments (Atom)
0 comments:
Please give your valuable comments.