读书人

request.getSession()、request.getSe

发布时间: 2012-12-19 14:13:15 作者: rapoo

request.getSession()、request.getSession(false)和request.getSession(true)的区别

request.getSession()、request.getSession(false)和request.getSession(true)的区别:

在J2EE的API文档中关于HttpSession getSession(boolean create)的说明是:
Returns the current HttpSession associated with this request or, if there is no current session and create is true, returns a new session.
而对于HttpSession getSession()的说明是:
Returns the current session associated with this request, or if the request does not have a session, creates one.

由此可见:request.getSession()和request.getSession(true)是等价的。

读书人网 >编程

热点推荐