wood burning stoves 2.0*
The moose likes Web Component Certification (SCWCD/OCPJWCD) and the fly likes Behavior of ServletContext VS Behavior of HttpSession Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Certification » Web Component Certification (SCWCD/OCPJWCD)
Bookmark "Behavior of ServletContext VS Behavior of HttpSession" Watch "Behavior of ServletContext VS Behavior of HttpSession" New topic
Author

Behavior of ServletContext VS Behavior of HttpSession

Satyajeet Kadam
Ranch Hand

Joined: Oct 19, 2006
Posts: 215
please tell me the difference between the "Behavior of ServletContext" VS "Behavior of HttpSession" in Distributed Environment?
nitin pai
Ranch Hand

Joined: May 30, 2006
Posts: 185
In a distributed environment,
Each JVM will have a separate ServletContext. So you cannot depend on the Conetext level attributes while sharing attribute information

But the Session object is shared between all the JVM's present in the environment. You can test this out by implementing the HttpSessionActivationListener on your attributes.

The attributes will be passivated and then activated when they move from one server to another but in this case your attributes must be serializable.



 
 
subject: Behavior of ServletContext VS Behavior of HttpSession
 
Similar Threads
EJB Stateful Session bean vs HTTP Session
setAttribute()
Access to servlet context in HttpSessionListener
A question about Request Vs Session
parameter vs attributes?