Contents | Prev | Next


<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



Contents | Prev | Next

Copyright © 2004, Sun Microsystems, Inc. All rights reserved.