Originally posted by Gagan Sabharwal:
How are the sessions more advantageous than servlet contexts?
Sessions belongs to a particular user whereas servletContext is shared by all active users. We store all user related info to the session of that particular user like, role etc. Whereas servletContext is used to store appication level information.
Session remains valid only as long as the users browser stays open and user remains active.
Edited after Bear's post servletContext remains valid until application goes out of service.
[ April 26, 2006: Message edited by: Adeel Ansari ]