12.4 The session Attribute

The session attribute controls whether the page participates in HTTP sessions. Use of this attribute takes one of the following two forms.

 <%@ page session="true" %> <%-- Default --%> <%@ page session="false" %> 

A value of true (the default) signifies that the predefined variable session (of type HttpSession ) should be bound to the existing session if one exists; otherwise , a new session should be created and bound to session . A value of false means that no sessions will be automatically created and that attempts to access the variable session will result in errors at the time the JSP page is translated into a servlet.

Using session="false" may save significant amounts of server memory on high-traffic sites. However, note that using session="false" does not disable session trackingit merely prevents the JSP page from creating new sessions for users who don't have them already. So, since sessions are user specific , not page specific , it doesn't do any good to turn off session tracking for one page unless you also turn it off for related pages that are likely to be visited in the same client session.

Core Servlets and JavaServer Pages (Vol. 1.Core Technologies)
Core Servlets and Javaserver Pages: Core Technologies, Vol. 1 (2nd Edition)
ISBN: 0130092290
EAN: 2147483647
Year: 2002
Pages: 194

Similar book on Amazon

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net