This week's book giveaway is in the OCAJP 8 forum. We're giving away four copies of OCA Java SE 8 Programmer I Study Guide and have Edward Finegan & Robert Liguori on-line! See this thread for details.
If you read the servlet specification, it will be clear to you that attributes stored in a ServletContext are not meant to be shared across different containers. The attributes are local to the VM in which they are created.
From Servlets 2.3 specification:
Context attributes are local to the VM in which they were created. This prevents ServletContext attributes from being a shared memory store in a distributed container. When information needs to be shared between servlets running in a distributed environment, the information should be placed into a session (See Chapter SRV.7, �Sessions�), stored in a database, or set in an Enterprise JavaBeansTM component.
"The trouble with doing something right the first time is that nobody appreciates how difficult it was!"
Joined: Jun 07, 2005
That means... if i want to share data, across the application.. and do not want to use listeners or populate some model class. I cannot use the context to share the data..