public HttpSession getSession(boolean create)
Returns the current HttpSession associated with this request or, if if there is no current session and create is true, returns a new session.
If create is false and the request has no valid HttpSession, this method returns null.
Parameters:
true - to create a new session for this request if necessary; false to return null if there's no current session
Returns:
the HttpSession associated with this request or null if create is false and the request has no valid session
帮助上是这么说的,
但实际用起来好像 getSession(true)有时会自动创建一个新的session,而把原来的session替换掉
getSession(true)和getSession(),有什么区别
最新推荐文章于 2023-06-27 15:46:33 发布