JSP.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 need not do anything special with this document.



Java 2 Platform, Enterprise Edition. Platform and Component Specifications
Java 2 Platform, Enterprise Edition: Platform and Component Specifications
ISBN: 0201704560
EAN: 2147483647
Year: 2000
Pages: 399

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net