Name

<jsp:output>

Synopsis

The <jsp:output> element can only be used in JSP Documents (JSP pages in XML syntax) and tag files in XML syntax. It modifies properties of the generated response.

Syntax

<jsp:output [omit-xml-declaration="true|yes|false|no"] 
  [doctype-root-element="elementName"
    [doctype-public="publicID"] doctype-system="systemID"]
/>

Attributes

Attribute name

Java type

Dynamic value accepted

Description

omit-xml-declaration
boolean

No

Set to true or yes to prevent an XML declaration to be added to the response, or to false or no to force an XML declaration to be added.

The default is yes for a JSP Document with a <jsp:root> element and for tag files in XML syntax, no for all other cases.

doctype-root-element
String

No

The root element name to use in the generated DOCTYPE declaration.

doctype-public
String

No

The Public ID to use in the generated DOCTYPE declaration.

doctype-system
String

No

The System ID to use in the generated DOCTYPE declaration.

Example

<!-- Add an XML declaration to the response -->
<jsp:output omit-xml-declaration="true" />

<!-- Add a DOCTYPE declaration to the response -->
  <jsp:output doctype-root-element="html"
    doctype-public="-//W3C//DTD XHTML 1.0 Transitional//EN"
    doctype-system='http://www.w3c.org/TR/xhtml1/DTD/xhtml1-transitional.dtd'/>

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.