background image

attribute Subelements

<< Declaring Tag Attributes for Tag Handlers | Declaring Tag Variables for Tag Handlers >>
<< Declaring Tag Attributes for Tag Handlers | Declaring Tag Variables for Tag Handlers >>

attribute Subelements

TABLE 8­10
attribute
Subelements
(Continued)
Element
Description
rtexprvalue
(optional) Whether the attribute's value can be dynamically calculated at runtime by
an EL expression. The default is false. When this element is set to true and the
attribute definition also includes either a deferred-value or deferred-method
element then the attribute accepts both dynamic and deferred expressions.
type
(optional) The runtime type of the attribute's value. Defaults to java.lang.String if
not specified.
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.
deferred-value
(optional) Indicates that the tag attribute accepts deferred value expressions. This
element includes an optional type child element, which indicates the type of object to
which the expression resolves. If no type element is included, the type is
java.lang.Object
. Either the deferred-value or deferred-method element (but
not both) can be defined for the same attribute.
deferred-method
(optional) Indicates that the tag attribute accepts deferred method expressions. This
element includes an optional method-signature child element, which indicates the
signature of the method that the expression invokes. If no method signature is
defined, the method signature default is void methodName(). Either the
deferred-value
or deferred-method element (but not both) can be defined for the
same attribute.
If a tag attribute is not required, a tag handler should provide a default value.
The tag element for a tag that outputs its body if a test evaluates to true declares that the test
attribute is required and that its value can be set by a runtime expression.
<tag>
<name>present</name>
<tag-class>condpkg.IfSimpleTag</tag-class>
<body-content>scriptless</body-content>
...
<attribute>
<name>test</name>
<required>true</required>
<rtexprvalue>true</rtexprvalue>
Tag Library Descriptors
Chapter 8 · Custom Tags in JSP Pages
253