background image

Directive Attributes

<< Declaring Tag Attributes in Tag Files | Variable Directive Attributes >>
<< Declaring Tag Attributes in Tag Files | Variable Directive Attributes >>

Directive Attributes

TABLE 8­3
attribute
Directive Attributes
(Continued)
Attribute
Description
deferredValueType
(optional) The type resulting from the evaluation of the attribute's value
expression. The default is java.lang.String if no type is specified. If both
deferredValueType
and deferredValue are specified, deferredValue must be
true. If deferredValue is true, the default of deferredValueType is
java.lang.Object
. Causes a translation error specified in a tag file with a JSP
version less than 2.1.
deferredMethod
(optional) Indicates whether the tag attribute accepts deferred method
expressions. If deferredMethod and deferredMethodSignature are specified
then deferredMethod must be true. The default of deferredMethod is true if
deferredMethodSignature
is specified, otherwise the default of
deferredMethod
is false. The presence of a deferred-method element in an
attribute definition precludes the inclusion of a deferred-value element.
Causes a translation error if specified in a tag file with a JSP version less than 2.1.
deferredMethodSignature
(optional) The signature of the method to be invoked by the expression defined
by the accompanying deferredMethod attribute. If deferredMethod is true and
this attribute is not specified, the method signature defaults to void
methodName()
. Causes a translation error if specified in a tag file with a JSP
version less than 2.1.
fragment
(optional) Whether this attribute is a fragment to be evaluated by the tag handler
(true) or a normal attribute to be evaluated by the container before being passed
to the tag handler.
If this attribute is true:
You do not specify the rtexprvalue attribute. The container fixes the
rtexprvalue
attribute at true.
You do not specify the type attribute. The container fixes the type attribute at
javax.servlet.jsp.tagext.JspFragment
.
Defaults to false.
Declaring Tag Variables in Tag Files
Tag attributes are used to customize tag behavior much as parameters are used to customize the
behavior of object methods. In fact, using tag attributes and EL variables, it is possible to
emulate various types of parameters: IN, OUT, and nested.
To emulate IN parameters, use tag attributes. A tag attribute is communicated between the
calling page and the tag file when the tag is invoked. No further communication occurs between
the calling page and the tag file.
To emulate OUT or nested parameters, use EL variables. The variable is not initialized by the
calling page but instead is set by the tag file. Each type of parameter is synchronized with the
calling page at various points according to the scope of the variable. See
"Variable
Synchronization" on page 239
for details.
Encapsulating Reusable Content Using Tag Files
The Java EE 5 Tutorial · September 2007
238