110 likes | 216 Views
Java EE 5. JavaServer Pages Documents. Outline. Introduction Adventages Identify Syntax. Introduction. A JSP document is a JSP page written in XML syntax. Because it is written in XML syntax, a JSP document is also an XML document. Adventages.
E N D
Java EE 5 JavaServer Pages Documents
Outline • Introduction • Adventages • Identify • Syntax
Introduction • A JSP document is a JSP page written in XML syntax. • Because it is written in XML syntax, a JSP document is also an XML document.
Adventages • You can author a JSP document using one of the many XML-aware tools on the market, enabling you to ensure that your JSP document is well-formed XML. • You can validate the JSP document against a document type definition (DTD).
Identify • • Use a Java Servlet Specification version 2.4 web.xml file and give your JSP document the .jspx extension. • • Include a jsp:root element in your JSP document. This method is backward-compatible with JSP 1.2. • • In your application's web.xml file, set the is-xml element of the jspproperty-group element to true.
Syntax - Directives • <%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %> • <…xmlns:c="http://java.sun.com/jsp/jstl/core"… • xmlns:u="urn:jsptld:/WEB-INF/tlds/my.tld“ • xmlns:u="urn:jsptagdir:/WEB-INF/tags/my/"
Syntax - Directives • <%@ page language="java" %> • <jsp:directive.page language="java" /> • <%@ include file="url" %> • <jsp:directive.include file="url" />
Syntax – jsp:root • <jsp:root> … </jsp:root> • When you want to identify the document as a JSP document to the JSP container without having to add any configuration attributes to the deployment descriptor or name the document with a .jspx extension • When you want to generate—from a single JSP document—more than one XML document or XML content mixed with non-XML content
Syntax - jsp:text • <jsp:text> … </jsp:text> • <jsp:text><![CDATA[ …]]></jsp:text>
Syntax – jsp:element • <jsp:element name=“top"> <jsp:attribute name="a">0</jsp:attribute> <jsp:body>cool</jsp:body></jsp:element> • <top a="0">cool</top> • <top a="0" />