background image

Declaring Tags

<< Tag File Location | Declaring Tag Attributes in Tag Files >>
<< Tag File Location | Declaring Tag Attributes in Tag Files >>

Declaring Tags

Declaring Tags
The tag directive is similar to the JSP page's page directive but applies to tag files. Some of the
elements in the tag directive appear in the tag element of a TLD (see
"Declaring Tag Handlers"
on page 251
).
Table 8­2
lists the tag directive attributes.
TABLE 8­2
tag
Directive Attributes
Attribute
Description
display-name
(optional) A short name that is intended to be displayed by tools. Defaults to the
name of the tag file without the extension .tag.
body-content
(optional) Provides information on the content of the body of the tag. Can be either
empty
, tagdependent, or scriptless. A translation error will result if JSP or any
other value is used. Defaults to scriptless. See
"body-content Attribute" on
page 237
.
dynamic-attributes
(optional) Indicates whether this tag supports additional attributes with dynamic
names. The value identifies a scoped attribute in which to place a Map containing the
names and values of the dynamic attributes passed during invocation of the tag.
A translation error results if the value of the dynamic-attributes of a tag directive
is equal to the value of a name-given of a variable directive or the value of a name
attribute of an attribute directive.
small-icon
(optional) Relative path, from the tag source file, of an image file containing a small
icon that can be used by tools. Defaults to no small icon.
large-icon
(optional) Relative path, from the tag source file, of an image file containing a large
icon that can be used by tools. Defaults to no large icon.
description
(optional) Defines an arbitrary string that describes this tag. Defaults to no
description.
example
(optional) Defines an arbitrary string that presents an informal description of an
example of a use of this action. Defaults to no example.
language
(optional) Carries the same syntax and semantics of the language attribute of the
page
directive.
import
(optional) Carries the same syntax and semantics of the import attribute of the page
directive.
pageEncoding
(optional) Carries the same syntax and semantics of the page-Encoding attribute in
the page directive.
isELIgnored
(optional) Carries the same syntax and semantics of the isEL-Ignored attribute of
the page directive.
Encapsulating Reusable Content Using Tag Files
The Java EE 5 Tutorial · September 2007
236