Page Directive | |
The page directive defines page-dependent attributes, such as scripting language, error page, and buffering requirements. A JSP translation unit (the source file and any files included via the include directive) can contain more than one page directive as long as each attribute, with the exception of the import attribute, occurs no more than once. If multiple import attribute values are used, they are combined into one list of import definitions. Example: <%@ page language="java" contentType="text/html;charset=Shift_JIS"%> <%@ page import="java.util.*, java.text.*" %> <%@ page import="java.sql.Date" %> |
autoFlush | Default: 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 | Default: 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 | Default: text/html |
The MIME type for the response generated by the page, and optionally the charset for the source page (e.g., text/html;charset=Shift_JIS). |
errorPage | No default |
A page- or context-relative URI path to which the JSP page will forward users if an exception is thrown by code in the page. |
extends | No default |
The fully qualified name of a Java class that the generated JSP page implementation class extends. The class must implement the JspPage or HttpJspPage interface in the javax.servlet.jsp package. Note that the recommendation is to not use this attribute. Specifying your own superclass restricts the web container's ability to provide a specialized, high-performance superclass. |
import | No default |
A Java import declaration; i.e., a comma-separated list of fully qualified class names or package names followed by .* (for all public classes in the package). |
info | No default |
Text that a web container may use to describe the page in its administration user interface. |
isErrorPage | Default: false |
Set to true for a page that is used as an error page, to make the implicit exception variable available to scripting elements. Use false for regular JSP pages. |
isThreadSafe | Default: true |
Set to true if the container is allowed to run multiple threads through the page (i.e., let the page serve parallel requests). If set to false, the container serializes all requests for the page. It may also use a pool of JSP page implementation class instances to serve more than one request at a time. The recommendation is to always use true and to handle multithread issues by avoiding JSP declarations and ensuring that all objects used by the page are thread-safe. |
language | Default: java |
The scripting language used in the page. |
session | Default: true |
Set to true if the page should participate in a user session. If set to false, the implicit session variable is not available to scripting elements in the page. |