page

The page Directive |

The page directive defines a number of important attributes that affect the whole page. A single JSP can contain multiple page directives, and during translation all the page directives are assimilated and applied to the same page together. However, there can be only one occurrence of any attribute/value pair defined by the page directive in a given JSP. (An exception is the import attribute, since there can be multiple imports.)

        <%@ page ATTRIBUTES %>

Example

        <%@ page language="java" import="java.rmi.*,java.util.*"
          session="true" buffer="12kb" autoFlush="true"
          info="my page directive jsp"  errorPage="Error.jsp"
          isErrorPage="false" isThreadSafe="false"%>

language |
Default: "Java" |
Defines the scripting language to be used. For future use if the JSP engine supports multiple languages.

extends |
Default: Attribute omitted by default. |
The value is a fully qualified class name of the superclass that the generated class (into which this JSP page is compiled) must extend. This attribute should be used with extreme caution because the engines usually provide specialized superclasses with a lot of functionality that the generated classes extend.

import |
Default: Attribute omitted by default. |
Comma separated list of packages or classes just like import statements in usual Java code.

session |
Default: "true" |
Specifies if the page participates in an HTTP session.

buffer |
Default: The default is buffered with an implementation buffer size of not less than 8kb. (The server can choose a value more than 8kb, depending on its implementation) |
Specifies the buffering model for the output stream to the client. If the value is "none", then no buffering occurs and all output is written directly through to the ServletResponse by a PrintWriter. If a buffer size is specified (e.g. 24kb) then output is buffered with a buffer size not less than that.

autoFlush |
Default:"true" |
If "true", the output buffer to the client is flushed automatically when it is full. If "false", a runtime exception is raised to indicate buffer overflow.

isThreadSafe |
Default: "true" |
Defines the level of thread safety implemented in the page. If "false" then the JSP processor queues up client requests sent to the page for processing. It processes them one at a time, in the order they were received. This is the same as implementing the javax.servlet.SingleThreadModel interface in a servlet.

Info |
Default: Omitted by default. |
Defines an informative string that can subsequently be obtained from the page's implementation of Servlet.getServletInfo() method.

isErrorPage |
Default: "false" |
Indicates if the current JSP page is intended to be the URL target of another JSP page's errorPage. If "true", then the implicit variable exception is available, and refers to the instance of the java.lang.Throwable thrown at runtime by the JSP causing the error.

errorPage |
Default: Omitted by default. |
Defines a URL to another JSP that is invoked if an unchecked runtime exception is thrown. The page implementation catches the instance of the Throwable object and passes it to the error page processing. See the isErrorPage attribute above.

contentType |
Default: The default value for the TYPE is "text/html"; the default value for the CHARSET is ISO-8859-1. |
Defines the character encoding for the JSP and the MIME type for the response of the JSP page. This can have either of the form "TYPE=MIME type" or "TYPE=MIME type; charset=CHARSET", with an optional white space after the ;. CHARSET, or character encoding if specified, must be the IANA value for a character encoding. IANA is the Internet Assigned Numbers Authority. The names, and other details, of the different character encodings can be found at http://www.iana.org/