"page directive" is one of the 3 directives, Java supports. "page" directive gives information, to the container, that can be applied to whole JSP file (page).
To give the information, page directive comes with 14 attributes. Each attribute gives a special processing information to the container.
JSP Page Directive Tutorial – Attribute list
|Attribute Name||What for?|
|import|| This attribute is equivalent to Java import. Used to import packages in JSP coding.
Example: JSP page import directive Example
|contentType||Sets the content type to the JSP page. Default is text/html.
Example: JSP page contentType directive set to text/plain Example
|extends|| It is very less used attribute. It specifies what super class, the generated servlet should extend.
Example: JSP page directive extends attribute with Example
|info|| Used to describe the JSP file like when the Project started, Programmers involved etc.
Example: JSP page directive info attribute Example
|buffer|| Sets the buffer size, in kilobytes, used to send the output to the client. Default size is 8 kb.
Example: JSP page directive buffer Example
|isThreadSafe||This attribute is equivalent to SingleThreadModel of Servlet. Default setting value is true which indicates the JSP is by default SingleThreadModel. If multithreaded environment is not required in JSP, set this attribute to false.
Example: page directive isThreadSafe attribute in JSP with Example
|language||Sets the language used to write JSP code. Default is Java.
Example: JSP page directive language attribute with Example
|session|| Default value is true indicating the JSP code can make use of sessions and when set to false, container does not allow to create new sessions.
Example: How to use page session attribute in JSP?
|autoFlush||If the value is set to true, the buffer will be flushed out implicitly when the output (response) buffer is full. Raises exception when set to false to indicate buffer overflow.
Example: JSP page directive autoFlush Example
|errorPage||Sets the name of the error page to which error messages are to be sent, if raised in the JSP file. Example: JSP Exception Handling – errorPage, isErrorPage, exception|
|isErrorPage||It this attribute value is set to true, the JSP file displays the error message by creating excetption (one of implicit objects) object. Example: JSP Exception Handling – errorPage, isErrorPage, exception|
|isELIgnored||Latest development in JSP is using Expression Language (EL). By default EL is enabled. When this attribute is set to true, container ignores EL in JSP code. Introduced with JSP 2.0. Example: JSP page directive isELIgnored attribute with Example|
|isScriptingEnabled||JSP code contains scriptlets, expressions and declarations. By default, this attribute is set to true and means these elements (non-EL) are recognized by the container. When set to false, if scriptlet etc. are used in code, the container raises translation-time error.|