Contents | Prev | Next


<jsp:output>

Specifies the XML declaration or the document type declaration in the request output of a JSP document or a tag file that is in XML syntax.

XML Syntax

<jsp:output ( omit-xml-declaration="yes|no|true|false" ) 	
   { doctypeDecl } />
   doctypeDecl ::= ( doctype-root-element="rootElement"
   doctype-public="PubidLiteral"
   doctype-system="SystemLiteral" )
   | ( doctype-root-element="rootElement"  	
      doctype-system="SystemLiteral" )

Examples

Here is an example of specifying a document type declaration with jsp:output:

<jsp:output doctype-root-element="books"	
   doctype-system="books.dtd" /> 

The resulting output is:

<!DOCTYPE books SYSTEM "books.dtd" > 

Description

The jsp:output element specifies the XML declaration or the document type declaration in the request output of the JSP document.

The XML declaration and document type declaration that are declared by the jsp:output element are not interpreted by the JSP container. Instead, the container simply directs them to the request output.

Generating a Document Type Declaration

A document type declaration (DTD) defines the structural rules for the XML document in which the document type declaration occurs. XML documents are not required to have a DTD associated with them.

Specifying the document type declaration in the jsp:output element will not cause the JSP container to validate the JSP document against the DTD.

If you want the JSP document to be validated against the DTD, you must manually include the document type declaration within the JSP document, just as you would with any XML document.

Generating XML Declarations

Here is an example of an XML declaration:

<?xml version="1.0" encoding="UTF-8" ?> 

This declaration is the default XML declaration. It means that if the JSP container is generating an XML declaration, this is what the JSP container will include in the output of your JSP document.

Neither a JSP document nor its request output is required to have an XML declaration. In fact, if the JSP document is not producing XML output then it shouldn't have an XML declaration.

The JSP container will not include the XML declaration in the output when either of the following is true:

The JSP container will include the XML declaration in the output when either of the following is true:

The jsp:output element has three attributes that you use to generate the document type declaration:

The rules for using the attributes are as follows:

Attributes

See Also



Contents | Prev | Next

Copyright © 2004, Sun Microsystems, Inc. All rights reserved.