<%@ taglib uri="..." prefix="tl" %>
<html>
<tl:parse id="saleBooks" type="BookInventory"
xml="Book_Inventory_URL"/>
<head>...
<body>
<table border="0" width="50%">
<tl:iterate
id ="bk" type="Book"
collection="<%= saleBooks.getBooks()%>" >
<tr>
<td><jsp:getProperty name="bk" property="title"/></td>
</tr>
</tl:iterate>
</table>
</body>
</html>
2.4 Parse and Iterate
<%@ taglib uri="..." prefix="tl" %>
<html>
<head>...
<body>
<table border="0" width="50%">
<tl:iterateOnXMLStream
id="bk" type="Book"
xml="Book_Inventory_URL">
<tr>
<td><jsp:getProperty name="bk" property="title"/></td>
</tr>
</tl:iterateOnXMLStream>
</table>
</body>
</html>
2.5 Combining Data
(插圖2)
2.6 Insert After Transformation
<%@taglib uri="http://jakarta.apache.org/taglibs/xsl/1.0"
prefix="x" %>
<html>
<head>...
<body>
<center> Welcome
<x:apply xml="Customer_URL" xsl="store.xsl"/>!
<p>
On Sale Today ...
<p>
<x:apply xml="Inventory_URL" xsl="store.xsl"/>
</center>
</body>
</html>
2.7 Producing XML
* Client may be
– Gateway
– Device (WAP, XHTML)
* XML
* XML + StyleSheet
2.8 VoiceXML and WAP Gateways
(插圖3)
2.9 Generating XML
J1 @ java.sun.com
(插圖4)
2.10 XSLT on XML
(插圖5)
2.11 JSP and XSLT
* JSP strengths
– Template & Java
– Multiple Sources
– Open-ended Portable Abstraction
* XSLT strengths
– Recursive tree transformation
– Well defined input/output
* XPath
2.12 Generating Content for
Multiple Devices
* One back end source
* Many clients
* Minimize Total Maintenance Cost
* Desired Generation Performance
2.13 Multiple Clients
XSLT Stylesheet
(插圖6)
2。14 Multiple Clients
Short Pipelines
(插圖7)
2.15 Multiple Clients
Combined Approach
(插圖8)
2.16 Uses of XML in JSP Technology
* JSPs Pages
JSP Pages as XML documents
* XML configuration
2.17 JSP Pages as XML Documents
* Manipulation
– Apply XSLT to generate JSP
* Authoring
– JSP pages from XML objects
* Validation
– TagLibraryValidator
* Standarized in JSP 1.2
2.18 XML Configuration
* Tag Library Descriptor
* Servlet configuration
– Resources
– Mappings
– Filters (JSP 1.2)
– others
3 現狀
3。1 Industry Support
Containers
Apache
Allaire
ATG Dynamo
BEA Weblogic
Bluestone
Caucho
Gemstone
IBM’ s WebSphere
Inprise AppServer