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>

<jsp:attribute>

The jsp:attribute element allows you to define the value of a tag attribute in the body of an XML element instead of in the value of an XML attribute.

JSP Syntax

<jsp:attribute name="attributeName" [ trim= "true | false" ] />

XML Syntax

Same as JSP syntax.

Examples

The following template page uses jsp:attribute, which uses the output of fmt:message to set the value of the value attribute of tt:parameter:

...
<tt:screen id="/bookcatalog">
   <tt:parameter name="title" direct="true">
      <jsp:attribute name="value" >
         <fmt:message key="TitleBookCatalog"/>
      </jsp:attribute>
   </tt:parameter>
...
</tt:screen>
...

Description

The jsp:attribute standard action has two uses:

All JSP standard actions and custom actions can contain a jsp:attribute standard element as a substitute for any of its attributes. One use case in which jsp:attribute is particularly helpful is where the value of an attribute is the result of a multi-line expression, which would not fit in the value of an attribute in the start tag of the action.

If an action contains any jsp:attribute elements and the action also has a body, it must use the jsp:body tag to represent the body. The body of jsp:attribute is restricted according to the type of attribute being specified:

Attributes

See Also



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

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

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

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