Name

Page Directive

Synopsis

This directive can only be used in JSP pages, not in tag files. It defines page-dependent attributes, such as scripting language, error page, and buffering requirements.

Syntax

<%@ page [autoFlush="true|false"] [buffer="8kb|NNkb|none"]
  [contentType="mimeType"] [errorPage="pageOrContextRelativePath"]
  [extends="className"] [import="packageList"] [info="info"]
  [isELIgnored="true|false] [isErrorPage="true|false"] 
  [isThreadSafe="true|false"] [language="java|language"] 
  [pageEncoding="encoding"] [session="true|false"]
%>

Attributes

Attribute name

Default

Description

autoFlush
true

Set to true if the page buffer should be flushed automatically when it’s full, or to false if an exception should be thrown when it’s full.

buffer
8kb

Specifies the buffer size for the page. The value must be expressed as the size in kilobytes followed by kb, or be the keyword none to disable buffering.

contentType
text/html or text/xml

The MIME type for the response generated by the page and optionally the response charset, e.g., text/html;charset=Shift_JIS. The charset applies to the JSP page file as well, if pageEncoding isn’t specified.

The default MIME type is text/html for a regular JSP page and text/xml for a JSP Document.

If no charset is specified, ISO-8859-1 is used for a regular JSP page and UTF-8 for a JSP Document.

errorPage

No default

A page- or context-relative URI path for the JSP page, servlet, or static page to forward to in case an exception is thrown ...

Get JavaServer Pages, 3rd Edition 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.