The Scope of a Session
A servlet context is a group of servlets (and possibly other Web entities), collected together in some directory.
Under Tomcat, servlet contexts are defined in the server.xml file.
Several servlets may be involved in the same session, hence share the same HttpSession object.
This sharing is automatic if the servlets are in the same context, and are interacting with the same browser.
Servlets from different contexts in the same server (or interacting with different browsers) always have distinct HttpSession objects.