Web Development with JavaServer Pages

Скачать в pdf «Web Development with JavaServer Pages»

Session attribute


The session attribute is used to indicate whether or not a JSP page participates in session management (as described in chapter 4). The value for this attribute is a simple boolean indicator, either true or false. For example, to specify that a page is not part of a session, the following form is used:


<%@ page session=»false» %>


The default value for this attribute is true; by default then, all pages participate in session management. If a JSP does not interact with the session, then a slight performance gain can be obtained by setting this attribute to false. Note, however, that the session implicit object, described in chapter 6, is available only on pages for which the session attribute is set to true.

Buffer attribute


The buffer attribute controls the use of buffered output for a JSP page. To turn off buffered output, so that all JSP content is passed immediately to the HTTP response, this attribute should be set to none, as follows:


<%@ page buffer=»none» %>


Alternatively, this attribute can be used to set the size of the output buffer in kilobytes, by specifying the attribute value as an integer, followed by the character string “kb”. For example:


<%@ page buffer=»12kb» %>


The default value for this attribute is «8kb». Note that the JSP container is allowed to use an output buffer larger than the requested size, if it so chooses; the specified value can therefore be thought of as the minimum buffer size for the page. This allows the JSP container to optimize performance by creating a pool of output buffers and using them as needed, instead of creating a new output buffer for every JSP page request.

Скачать в pdf «Web Development with JavaServer Pages»