Java: What is the role of the session invalidate () is it? Solving

Hand kill session.
There are two possible failure of the session: time-out and hand-kill session. Hand kill convenient and save time, programmers love to use.

For example, I do need to sign a program, there are middle of the page to access session control, if not logged jump to the login page, clear information when you exit the session.

This is have two choices: to empty the session data, or directly kill the session. Proposal directly kill the session and convenient.
If you exit the session is unclear, the other point the browser back, still you can access the site without logging in.
 
Asked
Session.invalidate directly when this thing that is most useful function is as exit () the session cleared on the line in order to avoid omissions, if you want to manually clear a particular session, can also be assigned null, is that right?
A chase
session.invalidate () to kill the session 

assignment null, empty the session is likely to be a trap.
2 who are different concepts. session is a container, which data can be stored. To eat in the cafeteria, for example: session is bowl, assigned null want to empty bowl, a bowl of rice worth of data, invalidate the equivalent of the bowl fell ().

Null assignment is a trap, developers do not use.

 

Guess you like

Origin www.cnblogs.com/shoshana-kong/p/11070033.html