First, Session
In web development, the server can create a session object for each yoghurt browser. Note: A browser is exclusive to a session object. Therefore, when the user data needs to be saved, the server program can write the user data to the user's browser exclusive session, when the user uses the browser to access other programs, the other program can remove the user data from the user's seesion and serve it
Ii. the difference between a session and a cookie
A cookie is a user's data addressed to a client
Session is to write the user's data to the user exclusive session
The session object is created by the server and the developer can invoke the GetSession method of the request object to get the Session object
Third, session realization principle
- How does the server implement a session for a user browser service?
After the server creates the session, it will put the ID number of the session to the client in the form of a cookie, so that, as long as the client's browser does not close, and then to the azimuth server, will take the session ID number, the server discovers the client's session ID, It will use the corresponding session in memory to serve it.
Java Web Session Management II: Sessions