background image

Tag File Location

<< Encapsulating Reusable Content Using Tag Files | Declaring Tags >>
<< Encapsulating Reusable Content Using Tag Files | Declaring Tags >>

Tag File Location

To learn how to configure the example, refer to the deployment descriptor (the web.xml file),
which includes the following configurations:
A display-name element that specifies the name that tools use to identify the application.
A welcome-file-list element that sets a particular page to be a welcome file.
Tag File Location
Tag files can be placed in one of two locations: in the /WEB-INF/tags/ directory or subdirectory
of a web application or in a JAR file (see
"Packaged Tag Files" on page 250
) in the
/WEB-INF/lib/
directory of a web application. Packaged tag files require a tag library descriptor
(see
"Tag Library Descriptors" on page 247
), an XML document that contains information
about a library as a whole and about each tag contained in the library. Tag files that appear in
any other location are not considered tag extensions and are ignored by the web container.
Tag File Directives
Directives are used to control aspects of tag file translation to a tag handler, and to specify
aspects of the tag, attributes of the tag, and variables exposed by the tag.
Table 8­1
lists the
directives that you can use in tag files.
TABLE 8­1
Tag File Directives
Directive
Description
taglib
Identical to taglib directive (see
"Declaring Tag Libraries" on page 172
) for JSP pages.
include
Identical to include directive (see
"Reusing Content in JSP Pages" on page 175
) for JSP pages.
Note that if the included file contains syntax unsuitable for tag files, a translation error will
occur.
tag
Similar to the page directive in a JSP page, but applies to tag files instead of JSP pages. As with
the page directive, a translation unit can contain more than one instance of the tag directive. All
the attributes apply to the complete translation unit. However, there can be only one occurrence
of any attribute or value defined by this directive in a given translation unit. With the exception
of the import attribute, multiple attribute or value (re)definitions result in a translation error.
Also used for declaring custom tag properties such as display name. See
"Declaring Tags" on
page 236
.
attribute
Declares an attribute of the custom tag defined in the tag file. See
"Declaring Tag Attributes in
Tag Files" on page 237
.
variable
Declares an EL variable exposed by the tag to the calling page. See
"Declaring Tag Variables in
Tag Files" on page 238
.
Encapsulating Reusable Content Using Tag Files
Chapter 8 · Custom Tags in JSP Pages
235