Session2
In WEB development, the server can create a session object (session Object) for each user's browser. Note: a browser exclusively occupies a session object (by default ). Therefore, when you need to save user data, the server program can write user data to the session exclusively occupied by the user's browser. When you use the browser to access other programs, other programs can extract the user data from the user's session to serve the user.
The main difference between Session and Cookie is:
Cookie is to write user data to the user's browser.
Session technology writes user data to a session exclusively owned by the user.
The Session object is created by the server. developers can call the getSession method of the request object to obtain the session object.
Session implementation principle
Session processing after IE disables cookies
This experiment demonstrates the problems caused by servlet data sharing after cookies are disabled.
Solution: URL rewriting
Response. encodeRedirectURL (java. lang. String url)
Used to rewrite the url address after the sendRedirect method.
Response. encodeURL (java. lang. String url)
Used to overwrite the url of form actions and hyperlinks
Additional: www.2cto.com
Session failure
Configure the session expiration time in the Web. xml file