摘要
本设计的研究与实现说明了Servlet的可移植性,面向对象性,实现了操
作的分布,计算的分布的分布式计算。Java Servlet技术是Sun在前不久推出
的面向服务器端的,与Applet相对应的技术,本人在国内比较早地采用Java
Servlet技术来开发Internet应用,是一个较新的尝试。在实现中提出“网络通
信以对象为本”的观点。本人充分利用Java Servlet和Java对象序列化技术,
实现了对象的迁移,创造性地实现了客户机Applet与服务器Servlet之间的对
象通信,使分布式计算,网络通信提高到一个新的层次,可以作为今后面向对
象的数据库访问的解决方案。从这一点上说,超越了传统上在HTTP/CGI协议
上传递名字/值对的做法。
本设计是主要采用Java Servlet,JDBC及JavaBeans技术的3层Web数
据库应用结构:用户界面层,事务逻辑层,数据贮存层。
第一层是支持Java的浏览器,包括网络计算机或者一般的Windows客户
机。客户端界面可以是复杂的Applet,也可以是一般的HTML页面。
第二层是由Web服务器和ServletEngine组成,其中SerletEngine用于运
行servlet。包含特定事务逻辑的Servlet是该层的特征。Servlet通过JDBC技
术来访问数据库,获取查询结果,动态生成并传输结果对象。
第三层是后台数据库。数据库储存应用所需要的信息。Servlet可以利用
JDBC接口方便地访问数据库。
借助Java计算技术,本人简化Internet上的分布式计算的设计如下:
首先应该编写能够在不同服务器,客户机,操作系统上运行的程序,即程
序语言应该是中立的,所以本人选择了Java语言。
其次,客户机应该能够动态地从服务器上下载新类,显然Java Applet符
合此要求。
最后,应该能够在服务器与客户机之间进行对象传递。本人采用Java的
对象序列化技术解决了此问题,即在Internet上传输对象。
可见计算是分布的,并不是完全由服务器一端的Servlet完成,Servlet不
是完全负责客户机Japplet的动态生成。Japplet客户端也参与了计算的协作,实
现了计算的分布,在某种程度上减轻了服务器的负担,并且两者以高层次的对象
进行通信,避免如字节流数据繁琐的通信,简化了通信协议。
In this paper , I set forth my view : Base Network Communication on
Object, I try to make network communication easy by transmitting Java
Object.
I would presented a 3-tier database application that use Java Servlet the
Java Database Connection(JDBC), JavaBeans. The application design model
is partitioned into three tiers:the user interface layer, the business rules layer
and the data store layer.
The first tier could use any number of Java-enabled browsers, including
ones running on Network Computers(NCs) as well as ones built on more
traditional platforms such as personal computers or workstations. Complex
user interface tasks would be handled by Java applets downloaded from the
second tier servers; simpler tasks could be handled using standard HTML
forms.
The second tier is implemented with a web server plus a ServletEngine
which be capable of executing Java Servlets. The second tier of such a system
would consist of servlets which encapsulate the particular business rules and
logic of the application.The Java Servlet harnesses the power of JDBC to
access the database to retrieve information as needed. A dynamic object is
generated by the servlet based on the database result.
The third tier is composed of back-end database. The database stores the
information that is used by the application. Servlet can access the database in
a portable fashion by using relational database interfaces such as JDBC.
I achieve distributed computing on Internet and make it easy by using java
computing. That is my idea :One of the keys to simplifying distributed
application development is to be able to write code that can run on either the
server or the client with no modification needed.
The first step toward reaching this goal is to have a common language for
the server application and all of the clients with their different operating
systems. So I choose Java
The next step is to be able to dynamically load new classes on the client as
needed. Of course applet on client can do that.
The last step is to pass objects back and forth between the server and the
client, so I make us of Object Serialization , in other word, using Object
Serialization to transport object across the Internet.
My idea went beyond the normal method of sending name /value pairs
over the HTTP/CGI protocol. The techniques present leveraged the feature of
Java object serialization. As you can see, this provided an elegant way of
transmitting serialized Java Object over network connections.
引文
1 www.sun.com
2 www.java.sun.com
3 www.ncworldmag.com
4 www.javasoft.com
5 developer.javasoft.com
6 jserv.java, sun.com
7 www.javaworld.com
8 www.objectspace.com
9 www.livesoftware.com
10 www.cbinews.com
11 im.muccune.net
12 www.j-nine.com
13 leaf.stpn.soft.net
14 www.webcom.com
15 www.ncp.com
16 www.cris.com
17 splash.javasoft.com
18 www.gamelan.com
19 www.io.org
1.Bruce Eckel:"Thinking in Java", Prentice, 1998
2.Peter Aitken, David H.FriedelJr., Anthony Potts: "Visual J++ Programming Front",Coriolis Group, 1996
3 James Gosling, Bill Joy, Addison-wesley: "The Java Language Specification",Simon Publishing House, 1996
4 Jamine Jaworkski:"Java Developer's Guide",SYBEXInc, 1997
5 E.Bayeh, "The WebSphere Application Server architecture and Programming model", IBM System Journa137
6 Sun JDK1.2 Refence Document
7 Visual Age for Java 2.0 online Help
8 Jbuilder 3.0 onlie Help
9 Sun Microsystems Inc. 《JDBC API Documentation》
10 Joe Weber, "Special Edition Using Java, 2nd Edition"
11 Jeffry Dwight, Michael erwin, Robert Niles: "Special edition Using CGI Second Edition",Que Corporation,97
12 Jamie Jaworski: "JAVA Developer's Guide"
13 Mark Wutka: "Java Expert Solutions"
14 Peter Norton, Wiliam Stanek: "Peter Norton's Guide to Java Programming"
15 Glenn L. Vanderburg :"Tricks of the Java Programming Gurus"
16 Peter Coffee: "How to program Java"
蔡家春,"The WebSphere Application Server框架和Java编程模型”——全国第二届Java技术应用学术会议论文集
杨德华,“利用Java实现面向对象的系统开发”,微型电脑,99.9
手谈,“走近Java服务器小件”,ChinaByte,99.1
陶先平,“流动agent:一种未来的分布式计算模式”,计算机科学,99.2
洪永清,<<面向对象建模与设计>>,人民邮电出版社98.12
王炜等,<>,清华大学出版社99.1