<jsp:body>any elements or text</jsp:body>
This example generates an HTML header
tag with a lang
attribute:
<jsp:element name="${content.headerName}" xmlns:jsp="http://java.sun.com/JSP/Page"> <jsp:attribute name="lang">${content.lang}</jsp:attribute> <jsp:body>${content.body}</jsp:body> </jsp:element>
The name
attribute identifies the generated tag's name. The jsp:attribute
tag generates the lang
attribute. The body of the jsp:attribute
tag identifies the value of the lang
attribute. The jsp:body
tag generates the body of the tag. The output of this example jsp:element
could be:
<h1 lang="fr">Heading in French</h1>
Normally, the body of a standard or custom action invocation is defined implicitly as the body of the XML element used to represent the invocation. The body of a standard or custom action can also be defined explicitly using the jsp:body
standard action. This is required if one or more jsp:attribute
elements appear in the body of the tag.
If one or more jsp:attribute
elements appear in the body of a tag invocation but no jsp:body
element appears or an empty jsp:body
element appears, it is the equivalent of the tag having an empty body.
It is also legal to use the jsp:body
standard action to supply bodies to any standard actions that accepts a body (except for jsp:body
, jsp:attribute
, jsp:scriptlet
, jsp:expression
, and jsp:declaration
). The body standard action accepts no attributes.