Declares attributes of custom actions defined in tag files. Used in tag files only.
<%@ attribute name="attribute-name" [ required="true | false" ] [ fragment="true | false" ] [ rtexprvalue="true | false" ] [ type="java.lang.String | a non-primitive type"] [ description="text" ] %>
<jsp:directive.attribute attributeDirectiveAttrList />
where attributeDirectiveAttrList is the same as the list for JSP syntax
<jsp:directive.attribute attributeDirectiveAttrList />
where attributeDirectiveAttrList is the same as the list for JSP syntax
The Duke's Bookstore example includes a custom tag, called shipDate
, that is defined in a tag file, shipDate.tag
. The tag file includes an attribute directive that declares the shipDate
tag's attribute, shipping:
<%@ attribute name="shipping" required="true" %>
Here is an example of the shipDate
tag used in the bookreceipt.jsp
page:
<sc:shipDate shipping="${param.shipping}" />
The attribute
directive allows the declaration of attributes for custom tags in tag files. This is analogous to the attribute element of a TLD file.
name = "
attribute-name"
attribute
directive appears in the same translation unit with the same name. A translation error results if there is an attribute
directive with a name
attribute equal to the value of the name-given
attribute of a variable
directive or the dynamic-attributes
attribute of a tag
directive in this translation unit.
required="true |
false"
fragment="true |
false"
true
) or a normal attribute to be evaluated by the container prior to being passed to the tag handler. If this attribute is true
:
rtexprvalue
attribute. The container fixes the rtexprvalue
attribute at true
.
type
attribute. The container fixes the type
attribute at javax.servlet.jsp.tagext.JspFragment
.
rtexprvalue="
true | false"
type="java.lang.String |
a non-primitive type"
java.lang.String
if not specified. It is a translation error to specify a primitive type.
description="
text"