Name
Attribute Directive
Synopsis
This directive can only be used in tag files. It declares the attributes the tag file supports.
Syntax
<%@ attribute name="attrName
" [description="description
"] [required="true|false
"] [fragment="true|false
" | [type="attrDataType
"] [rtexprvalue="true
|false"]] %>
Attributes
Attribute name |
Default |
Description |
description |
No default |
A description of the attribute that can be presented to a page author by an authoring tool. |
fragment |
false |
Set to |
name |
No default |
The attribute name. |
required |
false |
Set to |
rtexprvalue |
true |
Set to |
type |
String |
The attribute data type. Primitive types are not supported, only Java classes and interfaces. |
When the fragment
attribute is used, the
rtexprvalue
and type
attributes
must not be used. For a fragment, a runtime expression value is
always accepted and the type is fixed to
javax.servlet.jsp.tagext.JspFragment
.
Example
<%@ attribute name="date" type="java.util.Date" %> <%@ attribute name="pattern" fragment="true" %>
Get JavaServer Pages, 3rd Edition now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.