Java Reference
In-Depth Information
Directives
Directives are JSP elements that provide global information about an entire JSP page. An
example would be a directive that indicated the language to be used in compiling a JSP page.
The syntax of a directive is as follows:
<%@ directive { attribute =” value ”} %>
This states that, for this page directive, assign these values for these attributes. A directive can
contain n number of optional attribute/value pairs.
If we use our previous example for indicating the JSP language, the following line of code
would indicate that the JSP language to use would be Java:
<%@ page language=”java” %>
Three possible directives are currently defined by the JSP specification: page , include ,and
taglib . Each one of these directives and their attributes, if applicable, are defined in the fol-
lowing sections.
The page Directive
The page directive defines information that will be globally available for that JavaServer page.
These page level settings will directly affect the compilation of the JSP. Table 14.1 defines the
attributes for the page directive.
N OTE
Because the mandatory attributes are defaulted, you are not required to specify any
page directives.
T ABLE 14.1
The Attributes for the page Directive
Attribute
Definition
This attribute tells the server what language will be
used to compile the JSP file. Currently Java is the
only available language.
language=”scriptingLanguage”
This attribute defines the parent class that the JSP
generated servlet will extend from.
extends=”className”
This attribute defines the list of packages that will
be available to this JSP. It will be a comma-sepa-
rated list of package names.
import=”importList”
Search WWH ::




Custom Search