5. WEB Application Status Management
Hidden fields in the form:
<Input type = "hidden" name = "session" value = "...">
The disadvantage is that it is valid only when every page is dynamically generated.
Cookie:
The Cookie information is stored on the client. The maximum Cookie information is 4 kb.
Session tracking:
The HTTP Session is stored on the server, occupying the memory space.
Session Timeout management:
The default session in the container is 30 minutes.
Three methods for session destruction:
1. Session Timeout;
2. Call the invalidate () method on the Session object;
3. End the application (crash or cancel deployment ).
URL rewriting:
The phone uses it because the phone does not support cookies.
When the Cookie cannot work, the container will resort to URL rewriting to complete encoding for all URLs sent in the HTTP response.
HttpSession interface:
SetAttribute ("name", name); bind an object with a name in the Session.
GetAttribute ("name"); get the Session object with the specified name.
RemoveAttribute ("name"); deletes the Session object with the specified name.
Invalidate (); end of the session, which can be used to exit safely.