JSP Session Object comprehension: 2008.10.9
The Session Object implements the httpsession interface to save the status of each user. The Session object is saved in the container, and sessionid is sent back and forth between the server and the client through cookie. If the client does not support cookies, it will be automatically converted to URL rewriting.
Generally, when a client accesses a web application for the first time, the container creates a session object for it. The session object has a unique ID. In the container's response to the first access, the container sends the unique ID to the client browser through cookie. The browser sends the cookie to the server for each subsequent access. The Container obtains the sessionid from the cookie and finds the Session of the user in the container according to the sessionid. Therefore, a user's multiple HTTP requests correspond to the same session object.
Session Timeout: on the one hand, the container needs to save and manage session objects, which will occupy system resources; on the other hand, for security reasons, if the user does not exit the system normally, the user should be able to automatically exit the system after a period of time. Therefore, the session times out. When the session times out, the attributes of the session object and Session object are destroyed by the container.