Directive Tag gives special instruction to Web Container at the time of page translation. Directive tags are of three types: page, include and taglib.
|defines page dependent properties such as language, session, errorPage etc.|
|defines file to be included.|
|declares tag library used in the page|
We'll discuss about include and taglib directive later. You can place page directive anywhere in the JSP file, but it is good practice to make it as the first statement of the JSP page.
The Page directive defines a number of page dependent properties which communicates with the Web Container at the time of translation. Basic syntax of using the page directive is
<%@ page attribute="value" %> where attributes can be one of the following :
The import attribute defines the set of classes and packages that must be imported in servlet class definition. For example
<%@ page import="java.util.Date" %> or <%@ page import="java.util.Date,java.net.*" %>
language attribute defines scripting language to be used in the page.
extends attribute defines the class name of the superclass of the servlet class that is generated from the JSP page.
session attribute defines whether the JSP page is participating in an HTTP session. The value is either true or false.
isThreadSafe attribute declares whether the JSP is thread-safe. The value is either true or false
isErrorPage attribute declares whether the current JSP Page represents another JSP's error page.
errorPage attribute indicates another JSP page that will handle all the run time exceptions thrown by current JSP page. It specifies the URL path of another page to which a request is to be dispatched to handle run time exceptions thrown by current JSP page.
contentType attribute defines the MIME type for the JSP response.
autoFlush attribute defines whether the buffered output is flushed automatically. The default value is "true".
buffer attribute defines how buffering is handled by the implicit out object.