1. The sessionId of the Session is transmitted between the client and the server through the cookie of JSESSIONID.
2. The server will get the sessionId through the cookie JSESSIONID, and construct an HttpSession and put it in the request.
So we can get HttpSession from request.
Session operation interface:
HttpSession session = request.getSession(); //取得Session String sessionId=request.getSession().getId(); //取得sessionId session.setAttribute("variable name", value object); //Add attribute session.getAttribute("variable name"); //Object is taken out at this time, generally need to be forced session.removeAttribute("variable name"); //Remove attribute session.invalidate(); //Delete all keys saved in session