XML Syntax for JSP Directives and Scripting Elements

The syntax used for JSP directives and scripting elements in a regular JSP page won’t fly in a JSP Document; this syntax is not well-formed XML. You must use these XML elements with equivalent meaning instead:

<jsp:directive.page attribute_list />

Corresponds to <%@ page attribute_list %>, in which the attribute list contains all the attributes supported by the page directive, as described in Appendix A.

<jsp:directive.include file="file_path" />

Corresponds to <%@ include file="file_path" %>.

<jsp:declaration> ... </jsp:declaration>

Corresponds to <%! ...%>.

<jsp:expression> ... </jsp:expression>

Corresponds to <%= ... %>.

<jsp:scriptlet> ... </jsp:scriptlet>

Corresponds to <% ... %>.

The <jsp:directive.page> element with the contentType attribute in Example 17-10 shows you a concrete example of this syntax.

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.