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:attribute name="attributeName" [ trim= "true | false" ] />
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> ...
The jsp:attribute standard action has two uses:
jsp:element
action, which can only appear as a subelement of a standard or custom action.
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:
name="
attributeName"
jsp:attribute
tag is not being used with jsp:element
and the action does not accept dynamic attributes, the name must match the name of an attribute for the action being invoked, as declared in the Tag Library Descriptor for a custom action, or as specified for a standard action. If it doesn't match, a translation error results.
jsp:attribute
element is being used with a jsp:element
tag, a translation error results if both an XML element attribute and a jsp:attribute
element are used to specify the value for the same attribute.
QName
. If so, a translation error must occur if the prefix does not match that of the action it applies to, unless the action supports dynamic attributes or the action is jsp:element
.
trim= "
true | false"