Blog excerpt "request.getSession() method" May 30, 2023

The HttpRequest object has two forms of getSession method calls: one is getSession() and the other is getSession(boolen isNew). In this way, the former will detect whether a session exists at the current time. If it does not exist, it will create one. If it exists, it will return the current one. getSession() is equivalent to getSession(true); when the parameter is true, if a session exists, the session is returned, otherwise a new session is created; when the parameter is false, if a session exists, the session is returned, otherwise NULL is returned;

Guess you like

Origin blog.csdn.net/yz18931904/article/details/130947907