会员: 密码:  免费注册 | 忘记密码 | 会员登录 网页功能: 加入收藏 设为首页 网站搜索  
技术文档 > JAVA
JSP+XML的技术纲要
发表日期:2004-07-30 17:09:11作者: 出处:  


 

JSP+XML的技术纲要

 

Sun Microsystems ( http://java.sun.com/jsp )
作者:Eduardo Pelegri-Llopart (pelegri@eng.sun.com)

( Blueski.class编译 )

本文提纲:
* JSP, Servlets & J2EE
* JSP & XML
* 现状
(附:原文)


1 JSP, Servlets & J2EE


1.1 J2EE平台

* 具有明确的规范
* 经过了各种 兼容性测试
* 具有很多的 实施参考 (RI)
* 丰富的功能体现在以下方面:
?C JSP/Servlets
?C JDBC
?C EJB
?C JMS
?C Connector to EIS (J2EE 1.3)
* 具有非常实用的价值


1.2 J2EE所在的Web层

(请参考下图:)

 

1.3 JSP/Servlets扮演的角色
(译者注:我把JSP和Servelet混在一起了,你可参考本文所附的原文)

* application的入口
* 和外界交互
* 一般都采用HTTP协议
* 客户端可能是以下几种类型:
- Browser
- Applet
- Desktop application (Java Web Start)
- 无线设备
- Server application (B2B)

1.4 JSP/Servlets的用途
* 可以用于
?C JSP & Servlet Container
?C J2EE Container
* Common mindshare
* Best-of-breed implementation
* 已经获得 广泛的支持
* 动态内容生成
* 具有 简单化的构架
* 由container管理
* 经常 使用JavaBeans和Tag Lib

 

1.5 一个例子


<?xml version="1.0">
<%@ page contentType=”text/xml” %>
<%@ taglib prefix="x" uri="..." %>
<wml>
<card id="card1" title="Flowers">
<p>
Flowers available:
<br/>
<x:enumerate inventory="flowers"
id="aFlower">
<%= aFlower.type %>
<br/>
</x:iterate>
<br/>
</p>
</card>
</wml>

1.6 Tag Lib


* 抽象提炼
* XML语法
* Run-Time协议
?C 集成到JSP页面中去
?C 容易组合和定制
?C 由JSP container管理
?C 简单的协议,用于简单的需求

1.7 各种协同工作的角色


* 站点页面作者
?C 从数据开发者提供的数据中建立表达presentation
?C 用户界面方面的专家
?C 使用Tag Lib和JavaBeans
?C 使用页面工具
* 开发者
?C 为页面作者提供数据存取
?C 服务器端组织的专家
?C 定义Tag Lib和JavaBeans
?C IDE

2 JSP & XML


2.1 XML在JSP技术中的应用


JSP页面可以:
?C 使用XML
?C 生成XML
?C 改变XML
* 将JSP页面作为XML文档
* XML配置

2.2 使用XML


* 将XML解析到对象(由开发者完成)
?C 硬编码
?C 使用Adelard技术
* 解析和复述抽象
* 转变以后插入?C XSLT

2.3 解析成为对象


<%@ 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 解析和复述


<%@ 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 组合Data

(请参考下图:)




2.6 转化后插入

 


<%@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 制作XML


* 客户端可以是
?C Gateway网关
?C 设备(WAP, XHTML)
* XML
* XML + StyleSheet样式表

2.8 VoiceXML 和 WAP Gateway网关

(请参考下图:)





2.9 生成 XML

(请参考下图:)




2.10 XSLT on XML

(请参考下图:)




2.11 JSP和XSLT


* JSP强化了:
?C Template & Java
?C Multiple Sources
?C Open-ended Portable Abstraction
* XSLT强化了:
?C 循环的tree transformation
?C 有良好定义的输入输出
* XPath



2.12 生成内容用于


Multiple Devices
* One back end source
* 许多客户
* 将总的维护费用最小化
* 达到预期的性能



2.13 多客户的XSLT样式

(请参考下图:)




2.14 多客户的短管道 Short Pipelines

(请参考下图:)




2.15 多客户的组合途径

(请参考下图:)




2.16 在JSP技术中使用XML


* JSPs Pages
将JSP页面作为 XML文档

  * Manipulation
  ?C Apply XSLT to generate JSP
  * Authoring 
  ?C JSP pages from XML objects
  * Validation
  ?C TagLibraryValidator
  * Standarized in JSP 1.2

* XML配置

  * Tag Library Descriptor
  * Servlet configuration 
  ?C Resources
  ?C Mappings
  ?C Filters (JSP 1.2)
  ?C 其它



3 现状

3.1 业界支持

容器方面:
Apache,Allaire,ATG Dynamo,BEA Weblogic,Bluestone,Caucho,Gemstone,IBM’s WebSphere
Inprise AppServer,Iplanet iWS, iAS, Oracle,Persistence, Unify

一些用户:
PeopleSoft,I2,CP ...

一些站点:
Delta.com, Food.com, CarOrder.com ...

工具
MacroMedia UltraDev,Adobe GoLive,Unify eWeb Studio,WebGain’s Studio
Forte for Java,Oracle Jdeveloper,Inprise Jbuilder,ATG Dynamo, ...

3.2 新的JSP & Servlets技术

* JSR-053
* Servlet 2.3
?C Filters
?C Application Events
* JSP 1.2
?C JSP页面的XML方式查询
?C 许多改进和增强
*  Apache组织的推行
?C jakarta.apache.org/tomcat

3.3 JSP Tag Library


* JSR-052
* 标准的JSP tag library
?C 丰富的功能
?C XSLT
?C XPATH
?C 其它的XML的进程
?C Apache组织的推进( jakarta.apache.org/taglibs)

3.4 框架的支持


* J2EE体系
* JSP/Servlet体系
?C Struts
?C Apache组织的推进(jakarta.apache.org/struts)

3.5 JSP工具支持


* 大多数情况下是为页面作者提供的
?C 有一些是为TagLib工作者提供
* 已经存在于一些工具中
?C 例如,UltraDev支持Struts
* 近6个月的预测
?C 标准的taglib将出现,还有各种其他的taglib

3.6 XML解析和转化


* JAXP 1.1
?C 下一代 J2SE(JDK)的组成部分
?C DOM level 2
?C XSLT
?C 和TRaX (XSLT激活)进行组合
?C Apache组织的推进
* XSLTC
?C XSLT编译器
?C 更快,更小的脚本

3.7 数据绑定


Beans Long Term Persistance
* Adelard
?C 下一代J2SE的组成部分
?C 数据绑定
* JavaBeans Long Term Persistance
?C 下一代 J2SE的组成部分
?C 图形化Swing机制

3.8 XML Messaging


* XML messaging
?C JMS
?C ebXML
?C JAXM
?C Message Beans (J2EE 1.3)

(剧终)

*******************************

为防误译,特附原来文档,这是sun站点的官方pdf文档,有685K,我特地从中裁剪出来的。:)

JSP Technology and XML技术纲要
Eduardo Pelegri-Llopart
Sun Microsystems
pelegri@eng.sun.com
http://java.sun.com/jsp

提纲
* JSP, Servlets & J2EE
* JSP and XML
* Status

1 JSP, Servlets & J2EE
1。1 J2EE Platform

* Specification
* Compatibility Tests
* Reference Implementation (RI)
* Rich Functionality
?C JSP and Servlets
?C JDBC
?C EJB
?C JMS
?C Connector to EIS (J2EE 1.3)

1。2 J2EE Benefits

* Common Mindshare
?C Documentation
?C Training
?C Tool Support
* Portability
* Best-of-Breed Implementations

1。3 Web Layer of J2EE
(插图1)

1.4 Role of JSP and Servlets
* Entry point to application
* Interacts with the exterior
* Usually through HTTP
* Client may be:
* Browser
* Applet
* Desktop application (Java Web Start)
* Wireless Device
* Server application (B2B)

1.5 JSP and Servlets
* Can be used in
?C JSP & Servlet Container
?C J2EE Container
* Common mindshare
* Best-of-breed implementation
* Wide support

1.6 What Is a Servlet?
* Extension mechanism
* Dynamic content generation
* Mapped to URLs
* Simple architecture
* Managed by container

1.7 JSP Page
* A textual document
* Describes a request ?C response map
* Servlet Semantics

1.8 一个例子
<?xml version="1.0">
<%@ page contentType=”text/xml” %>
<%@ taglib prefix="x" uri="..." %>
<wml>
<card id="card1" title="Flowers">
<p>
Flowers available:
<br/>
<x:enumerate inventory="flowers"
id="aFlower">
<%= aFlower.type %>
<br/>
</x:iterate>
<br/>
</p>
</card>
</wml>

1.9 JSP Page
* A textual document
* Builds on
?C Template data
?C Dynamic content
* Tool friendly
* Abstraction using
?C JavaBeans
?C Tag Libraries

1.10 Tag Libraries
* Abstraction Mechanism
* XML syntax
* Run-Time Protocol
?C Integration into a JSP page
?C Easy to compose and customize
?C Managed by JSP container
?C Simple protocol for simple needs

1.11 Roles Involved
* Page and Site Author
?C Creates presentation from developer data
?C Expert in UI
?C Uses Tag Libraries & JavaBeans
?C Page Authoring tools
* Developer
?C Provides access to data for page author
?C Expert in server-side organization
?C Defines Tag Libraries & JavaBeans
?C IDEs

2 JSP & XML
2.1 Uses of XML in JSP Technology
JSPs Pages
?C Consuming XML
?C Generating XML
?C Transforming XML
* JSP Pages as XML documents
* XML configuration

2.2 Consuming XML
* Parse XML into objects (by developer)
?C Hand-coded
?C Using Adelard Technology
* Parse and Iterate abstraction
* Insert after transformation
?C XSLT

2.3 Parse Into Object
<%@ 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
?C Gateway
?C 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
?C Template & Java
?C Multiple Sources
?C Open-ended Portable Abstraction
* XSLT strengths
?C Recursive tree transformation
?C 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
?C Apply XSLT to generate JSP
* Authoring
?C JSP pages from XML objects
* Validation
?C TagLibraryValidator
* Standarized in JSP 1.2

2.18 XML Configuration
* Tag Library Descriptor
* Servlet configuration
?C Resources
?C Mappings
?C Filters (JSP 1.2)
?C others

3 现状

3。1 Industry Support

Containers
Apache
Allaire
ATG Dynamo
BEA Weblogic
Bluestone
Caucho
Gemstone
IBM’ s WebSphere
Inprise AppServer
Iplanet iWS, iAS
Oracle
Persistence
Unify

Some Users
* PeopleSoft
* I2
* CP
* ...

Some Sites
* Delta.com
* Food.com
* CarOrder.com
* ...

Tools
* MacroMedia
UltraDev
* Adobe GoLive
* Unify eWeb Studio
* WebGain’ s Studio
* Forte for Java
* Oracle Jdeveloper
* Inprise Jbuilder
* ATG Dynamo
* ...

3。2 New JSP & Servlets
* JSR-053
* Servlet 2.3
?C Filters
?C Application Events
* JSP 1.2
?C XML view of JSP page
?C Many improvements & refinements
* Implementation @ ASF
?C jakarta.apache.org/tomcat

3。3 JSP Tag Library
* JSR-052
* Standard JSP tag library
?C Rich functionality
?C XSLT
?C XPATH
?C Other XML processing
* Implementation @ ASF
?C jakarta.apache.org/taglibs

3。4 Framework efforts
* J2EE Framework
?C Blueprints
* JSP / Servlet Framework
?C Struts
?C Implementation @ ASF
?C jakarta.apache.org/struts

3。5 JSP Tool Support
* Mostly for Page Authoring
?C Some for TagLib Authoring
* Already in several tools
?C e.g. UltraDev support in Struts
* Focus next 6 months
?C Standard taglib
?C Any taglib

3。6 XML Parsing & Transformation
* JAXP 1.1
?C Part of next J2SE (JDK)
?C DOM level 2
?C XSLT
?C Combined with TRaX (XSLT activation)
?C Implementation @ ASF
* XSLTC
?C XSLT compiler
?C Fast, Small footprint

3。7 Data Binding
Beans Long Term Persistance
* Adelard
?C Part of next J2SE
?C Data Binding
* JavaBeans Long Term Persistance
?C Part of next J2SE
?C Generic Swing Machinery

3。8 XML Messaging
* XML messaging
?C JMS
?C ebXML
?C JAXM
?C Message Beans (J2EE 1.3)
**************************************************
Review
* JSP, Servlets & J2EE
* JSP
?C Consuming XML
?C Transforming XML
?C Producing XML
?C Relationship with XSLT
* Status of several JSP/XML efforts

(剧终)

 

返回顶部】 【打印本页】 【关闭窗口

关于我们 / 给我留言 / 版权举报 / 意见建议 / 网站编程QQ群   
Copyright ©2003- 2024 Lihuasoft.net webmaster(at)lihuasoft.net 加载时间 0.0041