Difference between HttpSession’s getSession(), getSession(true) and getSession(false) methods


  • getSession() : Returns the current session associated with this request, or if the request does not have a session, creates one.
  • getSession(true) : Returns the current HttpSession associated with this request, if there is no current session, returns a new session
  • getSession(false) : Returns the current HttpSession associated with this request, if there is no current session, returns null.