In web environment, I want one object to be access from everywhere so I put it into context. If I make it static and access it from class name wherever I wnat to access then what difference it would make??
If you place it in the context it will be lost but can be recreated each time the context is reloaded. The down side it that you can't enforce it's immutability - anyone that can see it can update it.
Depending on your setup, making it globally available (eg like a singleton) may not refresh with context restarts (don't confuse this with server restarts, you can often drop and restart a context without restarting the server). While this sounds OK, it isn't really a good design and can cause other unforseen ussues down the road.
Joined: Oct 11, 2004
But there must be some loss if we put object into context...