文档里说:
Returns the current HttpSession associated with this request or, if if there is no current session and create is true, returns a new session.
session你可以认为是每一个IE进程对应一个会话(你新开一个IE进程就可以对应两个会话的)
getSession都是返回当前用户的会话对象,参数的区别在于
参数为true,则如果“当前用户的会话对象”为空(第一次访问时)则创建一个新的会话对象返回
参数为false,则如果“当前用户的会话对象”为空,则返回null(即不自动创建会话对象)
本文解释了HTTP Session的概念及getSession方法的工作原理。详细说明了getSession方法如何根据参数true或false来决定是否创建新的会话对象。
1万+

被折叠的 条评论
为什么被折叠?



