O'Reilly logo

JavaServer Pages, Second Edition by Hans Bergsten

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Name

session

Synopsis

The session variable is assigned a reference to the HttpSession object that represents the current client’s session. Information stored as HttpSession attributes corresponds to objects in the JSP session scope.

By default, the session persists for a time period, specified in the web application deployment descriptor, across more than one page request from the user. The container can maintain a session in many ways, such as using cookies or rewriting URLs.

Synopsis

Variable name:

session

EL expression

${pageContext.session}

Interface name:

javax.servlet.http.HttpSession

Extends:

None

Implemented by:

Internal container-dependent class

JSP page type:

Available in both regular JSP pages and error pages, unless the page directive session attribute is set to false

Methods

public Object getAttribute(String name)

Returns the object associated d the specified name in this session or null if the object isn’t found.

public java.util.Enumeration getAttributeNames( )

Returns an Enumeration of String objects containing the names of all the objects in this session.

public long getCreationTime( )

Returns the time when this session was created, measured in milliseconds since midnight January 1, 1970 GMT.

public String getId( )

Returns a string containing the unique identifier assigned to this session.

public long getLastAccessedTime( )

Returns the time for the previous request associated with this session as the number of milliseconds since midnight ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required