Appendix A. JSP Elements Reference

JSP defines three types of elements: directives, scripting elements, and action elements. In addition, you can define your own custom actions. This appendix contains descriptions of all JSP elements as well as the general syntax rules for custom actions.

Each element is described with an overview, a syntax reference, an attribute table, and an example. The syntax reference shows all supported attributes, with optional attributes embedded in square brackets ([]). Mutually exclusive attributes are separated with vertical bars (|). For attributes that accept predefined values, all values are listed separated with vertical bars; the default value (if any) is underlined. Italics are used for attribute values that don’t have a fixed set of accepted values.

Directive Elements

Directive elements are used to specify information about the page itself, especially information that doesn’t differ between requests for the page. The general directive syntax is:

<%@ directiveName 
               attr1="value1" attr2="value2" %>

For a JSP Document (a JSP page written in XML syntax), the general syntax is:

<jsp:directive.directiveName 
               attr1="value1" attr2="value2" />

Only the syntax for regular JSP pages is shown in the detailed sections that follow.

The attribute values can be enclosed with single quotes instead of double quotes. The directive name and all attribute names are case-sensitive.

Get JavaServer Pages, Second 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.