Session Object
The session object is an instance of the Javax.servlet.http.HttpSession class. Has the same behavior as the session object in the Java servlets.
The session object is used to track sessions between individual client requests.
Main methods:
Each user is a different session, the server through the session ID to distinguish between different users, with
<%
String id = session.getid ();
%>
View IDs
The cookie that is automatically set in the cookie is the user's session ID, so the session uses the Cookiede processing mechanism during the operation, and if the server restarts, the session ID is reassigned
If you want to keep it, use the serialization mechanism
Landing and cancellation
This is the most used place in the session.
The most common part of the session in all projects is login verification and logoff
Test, landing page (based on previous landing page improvements):
login.jsp
<%@ page ContentType = "text/html" pageencoding = "GBK"%> <%@ page import = "java.sql.*"%>
welcome.jsp
<%@ page ContentType = "text/html" pageencoding = "GBK"%>
logout.jsp
<%@ page ContentType = "text/html" pageencoding = "GBK"%>
But this page is problematic, is "landing error" This information will always appear until you enter the correct information to jump. It will not be solved for the time being.
There are four techniques for session tracking:
Save through the form's hidden field through the session through the method provided by the session through address rewriting