Summary of the method used by the Request to obtain the Session, and request to obtain the session
Summary
1. No Request Parameters
Public HttpSession getSession ()
Obtain the session associated with the current request. If the current request does not have a session, create a session.
2. Request Parameters
Public HttpSession getSession (boolean create );
1) if create is true, if the session of the current request is empty, create one. If it is not empty, return the session associated with the current request.
2) If create is false, if the session of the current request is null, null is returned. If it is not null, the session associated with the current request is returned.
3. Summary
From the above we can see that the method without request parameters is equivalent to when the value of the request parameter is true.
The above is a detailed explanation of the request to obtain the Session. If you have any questions, please leave a message or go to the community on this site for discussion. Thank you for reading this article and hope to help you. Thank you for your support for this site!