View RSS Feed

My Java Tips

Checking if Session is new

Rate this Entry
by , 11-19-2011 at 07:26 PM (2667 Views)
Sessions are used to keep track of the user in applications. Specifically talking about web applications (JSP), we may store objects in the session as well for using them later. Sometimes we wish to know if the session is new or not. This post will show how to do that.


If a session is new, then isNew method of session object will return true otherwise false. When a server creates a session and client has not yet acknowledged the session, the server marks it with new. When the client joins a session, the session does not remain new anymore.


Java Code:
session.isNew();

Submit "Checking if Session is new" to Facebook Submit "Checking if Session is new" to Digg Submit "Checking if Session is new" to del.icio.us Submit "Checking if Session is new" to StumbleUpon Submit "Checking if Session is new" to Google

Tags: isnew, sessions Add / Edit Tags
Categories
Java EE , JSP

Comments