11.4. The session Attribute

The session attribute controls whether or not 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) indicates 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 used automatically and attempts to access the variable session will result in errors at the time the JSP page is translated into a servlet.

Get Core Servlets and JavaServer Pages™ now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.