What is the difference between request.getSession(boolean create) and request.getSession()?

The request.getSession() returns the current HttpSession associated with this request, or if the request does not have a session, creates one new session.

The request.getSession(boolean create) returns the current HttpSession associated with this request or, if there is no current HttpSession and create is true, returns a new session. If create is false and the request has no valid HttpSession, this method returns null and no new session created.

There is actually no difference between the request.getSession() method and the request.getSession(true) method.

Printer-friendly version Printer-friendly version | Send this 
article to a friend Mail this to a friend

Previous Next vertical dots separating previous/next from contents/index/pdf Contents

  |   |