C H A PT E R
7
JSP Pages as XML Documents
This chapter defines a standard XML document for each JSP page.
The JSP page to XML document mapping is not visible to JSP 1.1 containers; it will receive 
substantial emphasis in the next releases of the JSP specification. Since the mapping has not 
received great usage, we particularly encourage feedback in this area.
7.1
Why an XML Representation
There are a number of reasons why it would be impractical to define JSP pages as XML 
documents when the JSP page is to be authored manually:
An XML document must have a single top element; a JSP page is conveniently organized 
as a sequence of template text and elements.
In an XML document all tags are  significant ; to  pass through  a tag, it needs to be 
escaped using a mechanism like CDATA. In a JSP page, tags that are undefined by the 
JSP specification are passed through automatically.
Some very common programming tokens, like  <  are significant to XML; the JSP 
specification provides a mechanism (the <% syntax) to  pass through  these tokens.
On the other hand, the JSP specification is not gratuitously inconsistent with XML: all 
features have been made XML compliant as much as possible.
The hand authoring friendliness of JSP pages is very important for the initial adoption of the 
JSP technology; this is also likely to remain important in later time frames, but tool 
manipulation of JSP pages will take a stronger role then. In that context, there is an ever 
growing collection of tools and APIs that support manipulation of XML documents.
The JSP 1.1 specification addresses both requirements by providing a friendly syntax and 
also defining a standard XML document for a JSP page. A JSP 1.1 compliant tool needs not 
do anything special with this document.
 JSP Pages as XML Documents
124




JSP Web Hosting JavaServer Pages Specifications JSP Hosting




 
TotalRoute.net Business web hosting division of Vision Web Hosting Inc. All rights reserved.