How To Tell If The Session is New
A JSP or Servlet sometimes needs to carry on a 'session' for a user, so that when the user responds at the browser, the next JSP or Servlet will continue will information that is saved in the session. The HttpSession object is the source of such Session 'state' variables.
When this technique is being used, it important for the JSP or Servlet to know if it operating on an existing or a new Session. One would think that doing a
would be sufficient, and if it returns a 'null' it's a new session. These results are not always reliable.
The preferred technique is to say:
This will return either true or false, depending on whether the Session is new or not.