First, the difference between the two
Second, the life cycle of the session
1. The life cycle of a session is divided into three stages: creation, activity, and destruction.
2. Calling the session.invalidate() method can destroy the current session
. 3. Restarting the web server will destroy all sessions.