Preface

Comment

Declaration

Expression

Scriptlet

EL Expression

Directives

Attribute Directive

Include Directive

Page Directive

Tag Directive

Taglib Directive

Variable Directive

Standard Actions

<jsp:attribute>

<jsp:body>

<jsp:element>

<jsp:doBody>

<jsp:forward>

<jsp:getProperty>

<jsp:include>

<jsp:invoke>

<jsp:output>

<jsp:plugin>

<jsp:root>

<jsp:setProperty>

<jsp:text>

<jsp:useBean>

Attribute Directive

Declares attributes of custom actions defined in tag files. Used in tag files only.

JSP Syntax

<%@ attribute   name="attribute-name"
   [ required="true | false" ]
   [ fragment="true | false" ]
   [ rtexprvalue="true | false" ]
   [ type="java.lang.String | a non-primitive type"]
   [ description="text" ]
%>

OR

<jsp:directive.attribute attributeDirectiveAttrList />

where attributeDirectiveAttrList is the same as the list for JSP syntax

XML Syntax

<jsp:directive.attribute attributeDirectiveAttrList />

where attributeDirectiveAttrList is the same as the list for JSP syntax

Examples

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}" /> 

Description

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.

Attributes



宏飞网络是你学习web开发、测试web程序实例、和培养职业技能的首选网站。我们提供例子也许有些简单,但对理解基本概念有帮助。

我们尽量避免在教程、参考及例子中出现错误,但不能保证所有的内容都是正确的。

你使用本网站时,我们默认你已经阅读并接受了我们的隐私政策。

Copyright 2003-2011宏飞网络 版权所有