HttpSession session
Domain objects can access attribute values for sharing in the domain.
HttpSession server technology
The server will create a separate HttpSession for each user
HttpSession principle
When the user accesses the Servlet for the first time, the server will create an independent Session for the user
And generate a SessionID, this SessionID will be loaded into the cookie when responding to the browser, and then saved in the browser
When the user visits the Servlet again, the request will carry the SessionID in the cookie to visit
The server will check whether there is a corresponding Session object based on this SessionID
Use it if you have it; create a Session if you don't (equivalent to the user's first visit)
The scope of the domain:
Context domain>Session domain>Request domain
The Session domain will exist as long as the session does not end, but the Session has a default survival time (30 minutes)