JSP status management, jsp status
1. Stateless http protocol
Stateless means that when a browser sends a request to the server, the server responds to the client request. But when the same browser sends a request to the server again, the server does not know that it is the browser just now. Simply put, the server won't remember you, so it is a stateless protocol.
2. Two mechanisms for saving the user status
Cookie and Session Technologies
3. Cookie Introduction
Cookie: a series of text information stored on the client by the Web server.
Typical application: Determine whether a registered user has logged on to the website. Processing of the shopping cart.
Cookie: Tracking specific objects to save users' web browsing records and habits simplify logon security risks: easy to leak user privacy information.
4. Create and use cookies
For more information about cookies and sessions, see the Cookie and Session section in Servlet-core Foundation of JavaWeb technology and the cornerstone of JavaWeb framework (II.
5. Session and Cookie comparison
In common: all are used to save the user status; all expire sessions: the user information is saved on the server, and the Object type is saved. the stored data is destroyed as the Session ends, save important information.
Cookie: stores user information on the client, which is of the String type. It can be stored on the client for a long time to save unimportant user information.