Name
<jsp:element>
Synopsis
The
<jsp:element>
dynamically creates an XML element and adds it to the response.
It’s useful primarily in JSP Documents (JSP pages in
XML syntax), where other approaches can’t be used
because of the well-formedness requirement.
Syntax 1: Without a body
<jsp:element name="elementName
" />
Syntax 2: With a body
<jsp:element name="elementName
"><jsp:attribute> and/or <jsp:body> actions
</jsp:element>
Attributes
Attribute name |
Java type |
Dynamic value accepted |
Description |
name |
String |
Yes |
The name of the generated element. |
Example
<%-- Generates <a href="somepage.jsp">Some text</a> <jsp:element name="a"> <jsp:attribute name="href">somepage.jsp</jsp:attribute> <jsp:body>Some text</jsp:body> </jsp:element>
Get JavaServer Pages, 3rd Edition now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.