Wednesday, May 31, 2006

Session Object

The getSession method of the javax.servlet.http.HttpServletRequest interface has two overloads.
They are as follows:
• HttpSession getSession()
• HttpSession getSession(boolean create)

The first overload returns the current session associated with this request, or if the request does not have a session identifier, it creates a new one.
The second overload returns the HttpSession object associated with this request if there is a valid session identifier in the request. If no valid session identifier is found in the request, whether a new HttpSession object is created depends on the create value. If the value is true, a new HttpSession object is created if no valid session identifier is found in the request. Otherwise, the getSession method will return null.

0 Comments:

Post a Comment

<< Home