基于JSP的文档共享与交流平台毕业设计外文翻译、开题报告、文献综述

合集下载
  1. 1、下载文档前请自行甄别文档内容的完整性,平台不提供额外的编辑、内容补充、找答案等附加服务。
  2. 2、"仅部分预览"的文档,不可在线预览部分如存在完整性等问题,可反馈申请退款(可完整预览的文档不适用该条件!)。
  3. 3、如文档侵犯您的权益,请联系客服反馈,我们会尽快为您处理(人工客服工作时间:9:00-18:30)。

本科毕业设计任务书
基于JSP的文档共享与交流平台
设计与实现
院(系、部)名称:工商管理学院
专业名称:信息管理与信息系统
学生姓名:
学生学号:
指导教师:
2012年 5月 18日
指导教师签名:教学部主任审查签名:
本科毕业设计开题报告
基于JSP的文档共享与交流平台
设计与实现
院(系、部)名称:工商管理学院
专业名称:信息管理与信息系统
本科毕业设计中期检查表
本科毕业设计答辩记录表
本科毕业设计成绩评定汇总表
本科毕业设计工作总结
基于JSP的文档共享与交流平台
设计与实现
院(系、部)名称:工商管理学院
专业名称:信息管理与信息系统
本科毕业设计文献综述
基于JSP的文档共享与交流平台
设计与实现
院(系、部)名称:工商管理学院
专业名称:信息管理与信息系统
1选题背景和意义
1.1选题背景
随着科技的进步和全社会信息化程度的进一步加深,越来越多的人开始通过网络来了解和获得各种自己需要的信息,特别是一些专业人员对自己专业信息的需要。

在素质教育与终身教育成为必然的今天,人们对信息的需求有了更新,更高的要求,而基于WEB的信息平台由于本身所具有的信息量大,传递快速,没有时空限制等特点恰好满足这种要求。

整个社会的信息化进程不断加速,信息数字化旋风席卷全球,数字化资源已逐渐成为整个信息社会的核心资源之一。

特别是在最近的几十年中,数字技术和网络技术在各个领域的应用启发人们开始在文档资源的数字化使用、传播和保存方面的探索,发展趋势良好并取得一些阶段性的成果,文档资源的数字化共享已经成为大众所关注的重要领域之一[1]。

传统的纸质文档成本高,不利于保存,不利于查找、共享等方面的缺点,催生了人们寻求更简单、方便、快捷的保存文档的方法,为此建立一个基于JSP的文档共享管理平台,以满足人们对信息的需求。

多用户文档管理系统提供强大的全文检索功能以提高检索效率和准确性、灵活方便的权限管理提升文档的共享作用。

充分发挥信息共享的威力,提升办公效率。

1.2选题的意义
近年来,随着我国信息化的发展,科技事业已经迈入了一个全新的历史发展时期。

科技信息服务已不能继续停留在过去那种传统、单一的纸质文档资源管理和服务模式,特别是在互联网技术和计算机应用技术高速发展的今天,更应该遵循科学发展规律,采用先进的信息存储技术和管理技术来提高整个科技服务的层次和文档资源的信息化水平[2]。

因此,大力开发文档信息资源,构建强大的资源共享平台,实现文档数字化管理和资源共享,对于提高我国整体信息化水平具有十分重要的现实意义和长远意义。

通过这一平台,用户能够上传、管理、分享各种类型的文档,也能下载其他用户共享的文档,进一步提高了工作、学习的效率,带来了生活的便捷;除此之外,用户还可以通过交流平台,将进一步丰富问答双方的交流,更利于提高问题的解决率。

2国内外文档共享与交流平台发展现状及趋势
文档共享是网络信息共享的重要组成部分,是伴随着信息资源的丰富和个人PC电
脑的普及而形成的。

文档分享网站同样具备其他分享类网站的基本特征:(1)拥有各种对网民有价值的或文档或图片等资源;(2)分享类网站最显著的特征是互动,与资源上传者互动,与资源分享者互动,或二者兼有之的联系在一起。

文档共享网站的盈利模式主要有两种一是资源贩卖,二是广告联盟提供的广告。

2.1国外研究状况
文档共享平台虽然发展历史不长,但目前国外的在线文档共享平台发展已经相对成熟:(1)从功能定位上来讲,国外的文档共享网站实现了一个供网友在线分享文档的开放平台,以方便用户之间互相提供信息服务。

用户在对网站上某一文档有兴趣的时候,网站可以提供网民在线观看的模式,但是部分文档由于是作者付出许多心血写出的自己的观点,所以需求用户必须给出相应积分来下载文档,并且作者也能得到相应积分。

当用户在上传文档时,也必须按照一定的协议上传,不得通过任何不当的方式获取利益。

所以在一定的条件下,网站需要提出协议给予不同用户的权限,尽最大努力发挥网站信息灵活服务的优势。

(2)从效益定位来讲:作为一个信息交换以及传播平台,许多信息分享网站并非是公有化网站,所以在建设以及推广方面需要投入大量的人力、物力、财力,这就要求信息共享网站根据自身属性和特点,合理的获取一定的经济效益、局部效益和现实效益。

目前国外的经营模式除了传统的资源贩卖和广告收入外,还采用与版权方的合作分成、电子书销售等模式,扩大网站收益。

(3)从文化定位来讲,文档分享网站主要是基于传播一种网民之间分享各种领域和行业的文章以及各种资料来服务于社会的,它主要是一个储存各种有用信息的信息服务平台,体现着现代网络信息的传播性与独特性。

国外的文档共享网站通常建立一套严格的审查标准,对用户上传文档进行严格的审查,旨在做到打击盗版,和遏制不良信息对文化的污染。

国外著名的文档分享网站有:
(1)Docstoc:在线的文档与图片分享网站。

在线预览功能很强大。

(2)Scribd:自称是全球最大文档分享社区,每个月有1700万人在上面浏览文档,它支持最多的文档格式(doc, docx,ppt,pptx,pps,xls,xlsx,pdf, ps,odt, odp, sxw, sxi,txt, rtf)。

2.2国内的研究现状
国内在线文档的起步较国外晚,但今年来发展迅速,国内涌现了大批在线文档网站,其中的佼佼者如豆丁网、百度文库、道客巴巴、智客网等。

其中豆丁网从文档数量、版
权保护等技术的综合实力领先于其他网站。

百度文库拥有着最为庞大的用户群体,但深陷版权危机之中。

由此可以出,国内大部分发展迅速、规模大型的文档分享网站,多是借助原有的用户群体(百度文库借助其搜索引擎、新浪爱问借助其社交服务),发展壮大起来的。

虽然对于用户的准入、文档的开放程度和文档基数的发展有一定的积极作用,但容易造成版权危机。

所以,国内的文档分享平台还应学习国外优秀的经营模式和盈利模式,在文档开放的同时,维护作者版权,做到协调发展。

2.3发展趋势
根据国外发展的经验和国内出现的相关问题,我国未来文档共享平台的发展趋势主要有:
1、权威性与平民化并重
当一个文档分享网站的本钱可以或许和像中国期刊、维普资讯等付费数据库的资本的权威性相媲美,同时又可以或许给平民作者、本钱拥有者供给揭示分享平台的时候,那么文档分享网站就做到权威性与互动性并举。

从不同品位上满足目标受众的需要、雅俗并举,充分变动网民参与的积极性,这将是文档分享网站一个重要的生长趋向。

2、从垂直走向整合
由于文档分享网站属于网络资源分享网站的一部分,而大多数的分享网站都各自经营单独的部分;如文档分享、视频分享网站、音乐分享网站、图片分享网站等。

但这些具有相同功能和营业模式的网站最终的发展趋势是整合。

3、对网站目标大众需要的充分挖掘与盈利模式的多元化
要充分挖掘目标受众的需要,应和大众的需求就是胜利的砝码。

网站的服务内容设计中,特色服务是一项非常重要的内容。

3 基于JSP的在线文档共享与交流平台涉及的内容
3.1 基于JSP的文档共享平台所涉及的关键技术和特点
3.1.1 JSP 技术
JSP是(Java Server Pages)是基于Java Servlet以及整个Java体系的Web开发技术。

JSP技术是SUN公司提出的,它充分利用了Java的通用性,同时,针对Java的速度问题进行了优化。

另外,由于许多大公司开始支持JSP的Web服务器,这使得JSP已经成为架设动态网站的成熟技术,它利用JDBC(Java Database Connectivity)的API实现对后台数据服务器的访问,由于JDBC是独立于数据库服务器系统的,要访问不同的数据
库( SQL Server、Oracle、DB2等),就要针对不同数据库的JDBC驱动程序来连接这些
数据库。

3.1.2 MVC设计模式及其框架技术
为了是web开发更为简单,往往采用科学的设计模式,基于java面向对象的编程思想形成的MVC设计模式渐渐成为主流。

MVC英文即Model-View-Controller,即把一个应用的输入、处理、输出流程按照Model、View、Controller的方式进行分离,这样一个应用被分成三个层——模型层、视图层、控制层,使开发更为便捷,提高程序的重用性,降低耦合度。

而基于MVC设计模式形成的各种框架技术也逐渐成为主流,对于JSP网站的开发过程中,目前最流行的框架组合式SSH(Struts2、Spring、hibernate),Struts2负责视图层的实现,用于封装用户的业务方法;Spring作为控制器,是连接用户业务方法与数据库持久层的桥梁。

Hibernate作为优秀的持久层框架,对java中的JDBC进行了轻量
级的封装,使用户更加随心所欲的操作数据库。

三者共同构成整个网站的体系。

3.1.3基于JSP的文档共享平台的特点
1.各施其职,互不干涉。

在MVC模式中,三个层各施其职,所以如果一旦哪一层的需求发生了变化,就只需要更改相应的层中的代码而不会影响到其它层中的代码。

2.有利于开发中的分工。

在MVC模式中,由于按层把系统开,那么就能更好的实现开发中的分工。

网页设计人员可以进行开发视图层中的JSP,对业务熟悉的开发人员可开发业务层,而其它开发人员可开发控层。

3.有利于组件的重用。

分层后更有利于组件的重用。

如控制层可独立成一个能用的组件,视图层也可做成通用的操作界面。

3.2 基于JSP的在线文档共享与交流平台的主要设计目标
基于以上技术描述和文档共享平台的发展状况,该平台应该完成以下的功能:
1、为登陆用户提供上传和下载文档服务
在用户登陆的前提下,用户可以在系统设定的格式要求和大小范围下自由上传任何文档文件(上传后需经审核),并在下载权限的控制下自由下载各类文档,并扣除相应的下载积分。

2、提供文档的解析和在线播放服务
在用户成功上传文档的前提下,为文档提供格式转换和在线播放服务。

主要是指把一般的文档(pdf除外)转换了pdf格式,并把pdf转换为能在浏览器中显示的swf文件,
使用Web前端技术实现在线播放。

3、为用户提供积分等服务
积分服务一方面指的是当用户成功上传文档后,根据文档设定的积分,在一定的下载量内的扣除其他用户的积分转换为上传者的积分;如果用户没有设定文档的积分,系统可默认给用户添加一定的积分。

另一方面指当用户下载文档时,如果该文档有积分设定,那么下载者就要相应的支付这些积分以完成下载。

4、提供权限控制功能
权限控制主要指仅提供登陆用户能够上传文档,并且只有用户的积分不少于文档的设定积分时才允许用户下载文档。

5、网站论坛功能
允许登录用户发起会话,并进行交流,每位会员拥有自己的个人中心,查看自己参与的话题。

未登录用户可以游客身份对话题进行评论,但核心答案会受到屏蔽,而且不能发起会话(发帖)。

4 存在的问题和解决方法
4.1、在线分享网站发展过程中存在的问题及解决方案:
我国在线文档分享网站目前存在的主要问题是文档的版权问题,由于高度的分享自由和不严密的文档审查制度,导致越来越多的分享网站陷入版权纠纷中。

解决措施:未解决这一问题,应从两方面着手:
(1)与越来越多的出版社、公司等展开合作,加大内容导入。

与机构合作,在丰富优质版权资源的同时,也消除了因盗版内容所带来的隐患。

(2)、强化管理审查机制,对用户文档进行严格审核,将技术和人工审查相结合。

尽最大可能减少不良信息和侵权行为的危害。

4.2、网站建设过程中存在的技术难点及解决方案
在线文档分享平台最重要同时也是最大的技术难题在于,用户上传的文档都能在网页中预览,却不能进行复制、剪切。

通常实现这一功能的大体功能是将上传的doc、ppt、txt文档转换成pdf,再将pdf文件转化成swf格式flash形式,交由页面显示。

具体步骤是:
第一步:文档--->转换为pdf。

利用OpenOffice和jodconverter插件包,OpenOffice 是sun公司自己用Java写的一套开源office软件,因为java是sun公司开发的跨平台的面向对象的编程语言,所以以java语言开发的jodconverter插件与OpenOffice套件的组
合,可以实现跨平台的运行,在任意的服务器上操作。

两种软件都是开源免费的。

缺点就是OpenOffice套件文件很大。

第二步:pdf-->转swf。

利用pdf2swf软件,pdf2swf提供了命令行参数,我们可以通过Java的Runtime和Process调用pdf2swf提供的命令将pdf转为swf。

第三步:将swf文件通过flexpaper在浏览器中显示,FlexPaper是一个开源轻量级的在浏览器上显示各种文档的组件,被设计用来与PDF2SWF一起使用,使在Flex中显示PDF成为可能,而这个过程并无需PDF软件环境的支持。

它可以被当做Flex的库来使用。

参考文献
[1] 王焕卫、朱林、刘清华,基于CORBA的分布式文档工作流管理的实现,计算机工程应用,2003.30
[2] 张爱梅.数字图书馆的个性化信息服务. 图书馆学刊,2003.6
[3] 沈嫒芬,林万莲主编.信息服务及其利用.武汉:华中师范大学出版社,1996.7
[4] 张成昱,来强,王平,赵仪,孔黎.分布式网络信息资源重构模式及系统实现.清华大学学报,2003.2
[5] 薛华,薛福任,工作流技术及其在网上审批中的应用,计算机工程与应用,2004.22
[6] 胡杰,党延忠,基于web的工作流技术在文档管理系统中的应用,计算机工程与应用,2003. 12
[7] 皮晓青,唐守渊,冯驰,梁伟,王润,科技资源开放与共享策略[M]重庆:西南师范人学出版社
2009.2
[8] 王中网络版权的贬值和措施电子知识产权2009.08
[9] 严蔚敏,吴伟民主编. 数据结构清华大学出版社2006.5
[10] (美) 斯贝尔(Spell,B.) 著;董梁,刘艳译java高级编程(第二版)清华大学出版社2006.11
[11] 刘俊亮王清华JSP Web开发学习实录清华大学出版社2011.7(1)
[12] 蒲子明许勇王黎Struts2+Hibernate+Spring整合开发技术详解清华大学出版社2011.8
[13 ]M. Waldman, A.D. Rubin, and L.F. Cranor, "Publius: A robust, tamper-evident, censorship-resistant
web", Proceedings of the 9th USENIX Security Symposium, August 2000.
[14] Freenet Web site: /
[15] I. Clarke, O. Sandberg, B. Wiley, and T.W. Hong, “Freenet: A Distributed Anonymous Information
Storage and Retrieval System in Designing Privacy Enhancing Technologies”, International Workshop on Design Issues in Anonymity and Unobservability, LNCS 2009, July 2000.
[16] Mojo nation Web Site: /
[17] R. Dingledine, M.J. Freedman, and D. Molnar, "Chapter 12: Free Haven", In Peer-To-Peer: harnessing
the Power of Disruptive Technologies, Ed. Andy Oram. Cambridge: O'Reilly and Associates, 2001. [18] R. Dingledine, M.J. Freedman, and D. Molnar, “The Free Haven Project: Distributed Anonymous
Storage Service”, International Workshop on Design Issues in Anonymity and Unobservability,
LNCS 2009, July 2000.
[19] D. Nam, M. Lee, J. Lee, and S. Han, “Distributed Document Sharing System”, Term Project Report,
June 2001.
本科毕业设计外文翻译
JSP technology and mainstream open-source framework for JAVA EE
院(系、部)名称:工商管理学院
专业名称:信息管理与信息系统
2012年 5月 18日
JSP technology and mainstream open-source framework for
JA V AEE
1.JSP Profile
JSP (Java Server Pages) is initiated by Sun Microsystems, Inc., with many companies to participate in the establishment of a dynamic web page technical standards. JSP technology somewhat similar to ASP technology, it is in the traditional HTML web page document (*.htm, *. html) to insert the Java programming paragraph (Scriptlet) and JSP tag (tag), thus JSP documents (*.jsp). Using JSP development of the Web application is cross-platform that can run on Linux, is also available for other operating systems.
JSP technology to use the Java programming language prepared by the category of XML tags and scriptlets, to produce dynamic pages package processing logic. Page also visit by tags and scriptlets exist in the services side of the resources of logic. JSP page logic and web page design and display separation, support reusable component-based design, Web-based application development is rapid and easy.
Web server in the face of visits JSP page request, the first implementation of the procedures of, and then together with the results of the implementation of JSP documents in HTML code with the return to the customer. Insert the Java programming operation of the database can be re-oriented websites, in order to achieve the establishment of dynamic pages needed to function.JSP and Java Servlet, is in the implementation of the server, usually returned to the client is an HTML text, as long as the client browser will be able to visit.
JSP 1.0 specification of the final version is launched in September 1999, December has introduced 1.1 specifications. At present relatively new is JSP1.2 norms, JSP2.0 norms of the draft has also been introduced.
JSP pages from HTML code and Java code embedded in one of the components. The server was in the pages of client requests after the Java code and then will generate the HTML pages to return to the client browser. Java Servlet JSP is the technical foundation and large-scale Web application development needs of Java Servlet and JSP support to complete. JSP with the Java technology easy to use, fully object-oriented, and a platform-independent and secure mainly for all the characteristics of the Internet. JSP technology strength: (1) time to prepare, run everywhere. At this point Java better than PHP, in addition to systems, the code not to make any changes.(2) the multi-platform support. Basically on all platforms of any development environment, in any environment for deployment in any environment in the expansion. Compared ASP / PHP limitations are obvious. (3) a strong scalability. From only a small Jar documents can run Servlet / JSP, to the multiple servers clustering and load
balancing, to multiple Application for transaction processing, information processing, a server to numerous servers, Java shows a tremendous Vitality. (4) diver sification and powerful development tools support. This is similar to the ASP, Java already have many very good development tools, and many can be free, and many of them have been able to run on a variety of platforms under. JSP technology vulnerable:(1) and the same ASP, Java is the advantage of some of its fatal problem. It is precisely because in order to cross-platform functionality, in order to extreme stretching capacity, greatly increasing the complexity of the product. (2) Java's speed is class to complete the permanent memory, so in some cases by the use of memory compared to the number of users is indeed a "minimum cost performance." On the other hand, it also needs disk space to store a series of. Java documents and. Class, as well as the corresponding versions of documents.
2. J2EE Development Framework
Java2 Enterprise Edition middleware unified ideology played a significant role. For example, J2EE for distributed transaction management, directory services and messaging services provide a standard programming interface. J2EE-based -Java2Standard Edition (J2SE), successfully access for Java provides a standard relational database.
But, as this article "J2EE programming of the lack of support", as mentioned, J2EEplatform does not provide a satisfactory application programming model. Sun and some of the major application server vendors wanted to use the development tools to reduce the complexity of J2EE development, but these tools are no other outstanding JA V A development tools, which have advanced refactoring tools, and. NET platform compared, J2EE tool support appeared to be very inferior.
Many J2EE development tools automatically generate the code for the same complex as the tools themselves. In many small-scale J2EE open source community developers chose another way of development - some can be difficult to reduce the development of J2EE development framework, the more popular such as: Struts, Hibernate, and Spring Framework, J2EE project types in many of today they play an important the role.
2.1 Spring Framework
The Spring Framework is an open source application framework for the Java platform.
The first version was written by Rod Johnson who released the framework with the publication of his book Expert One-on-One J2EE Design and Development in October 2002. The framework was first released under the Apache 2.0 license in June 2003. The first milestone release, 1.0, was released in March 2004, with further milestone releases in
September 2004 and March 2005. The Spring 1.2.6 framework won a Jolt productivity award and a JAX Innovation Award in 2006. Spring 2.0 was released in October 2006, and Spring 2.5 in November 2007. In December 2009 version 3.0 GA was released. The current version is 3.0.5.
The core features of the Spring Framework can be used by any Java application, but there are extensions for building web applications on top of the Java EE platform. Although the Spring Framework does not impose any specific programming model, it has become popular in the Java community as an alternative to, replacement for, or even addition to the Enterprise JavaBean (EJB) model.
Modules The Spring Framework comprises several modules that provide a range of services:
Inversion of Control container: configuration of application components and lifecycle management of Java objects
Aspect-oriented programming: enables implementation of cross-cutting routines
Data access: working with relational database management systems on the Java platform using JDBC and object-relational mapping tools
Transaction management: unifies several transaction management APIs and coordinates transactions for Java objects
Model-view-controller: an HTTP and Servlet-based framework providing hooks for extension and customization
Remote Access framework: configurative RPC-style export and import of Java objects over networks supporting RMI, CORBA and HTTP-based protocols including web services (SOAP)
Convention-over-configuration: a rapid application development solution for Spring-based enterprise applications is offered in the Spring model.
Batch processing: a framework for high-volume processing featuring reusable functions including logging/tracing, transaction management, job processing statistics, job restart, skip, and resource management
Authentication and authorization: configurable security processes that support a range of standards, protocols, tools and practices via the Spring Security sub-project (formerly Acegi Security System for Spring).
Remote Management: configurative exposure and management of Java objects for local or remote configuration via JMX
Messaging: configurative registration of message listener objects for transparent message
consumption from message queues via JMS, improvement of message sending over standard JMS APIs
Testing: support classes for writing unit tests and integration tests
Inversion of Control container Central to the Spring Framework is its Inversion of Control container, which provides a consistent means of configuring and managing Java objects using callbacks. The container is responsible for managing object lifecycles: creating objects, calling initialization methods, and configuring objects by wiring them together.
Objects created by the container are also called Managed Objects or Beans. Typically, the container is configured by loading XML files containing Bean definitions which provide the information required to create the beans.
Objects can be obtained by means of Dependency lookup or Dependency injection. Dependency lookup is a pattern where a caller asks the container object for an object with a specific name or of a specific type. Dependency injection is a pattern where the container passes objects by name to other objects, via either constructors, properties, or factory methods.
In many cases it's not necessary to use the container when using other parts of the Spring Framework, although using it will likely make an application easier to configure and customize. The Spring container provides a consistent mechanism to configure applications and integrates with almost all Java environments, from small-scale applications to large enterprise applications.
The container can be turned into a partially-compliant EJB3 container by means of the Pitchfork project. The Spring Framework is criticized by some as not being standards compliant. However, Spring Source doesn't see EJB3 compliance as a major goal, and claims that the Spring Framework and the container allow for more powerful programming models.
Aspect-oriented programming framework The Spring Framework has its own AOP framework which modularizes cross-cutting concerns in aspects. The motivation for creating a separate AOP framework comes from the belief that it would be possible to provide basic AOP features without too much complexity in either design, implementation, or configuration. The SAOP framework also takes full advantage of the Spring Container.
The Spring AOP framework is interception based, and is configured at runtime. This removes the need for a compilation step or load-time weaving. On the other hand, interception only allows for public or protected method execution on existing objects at a join point.
Compared to the AspectJ framework, Spring AOP is less powerful but also less complicated. Spring 1.2 includes support to configure AspectJ aspects in the container. Spring
2.0 added more integration with AspectJ; for example, the pointcut language is reused and can be mixed with SpAOP-based aspects. Further, Spring 2.0 added a Spring Aspects library which uses AspectJ to offer common Spring features such as declarative transaction management and dependency injection via AspectJ compile-time or load-time weaving. Spring Source also uses AspectJ for AOP in other Spring projects such as Spring Roo and Spring Insight, with Spring Security also offering an AspectJ-based aspect library.
Spring AOP has been designed to make it able to work with cross-cutting concerns inside the Spring Framework. Any object which is created and configured by the container can be enriched using Spring AOP.
The Spring Framework uses Spring AOP internally for transaction management, security, remote access, and JMX.
Since version 2.0 of the framework, Spring provides two approaches to the AOP configuration:schema-based approach.@AspectJ-based annotation style.
The Spring team decided not to introduce new AOP-related terminology; therefore, in the Spring reference documentation and API, terms such as aspect, join point, advice, pointcut, introduction, target object (advised object), AOP proxy, and weaving all have the same meanings as in most other AOP frameworks (particularly AspectJ).
Data access framework Spring's data access framework addresses common difficulties developers face when working with databases in applications. Support is provided for all popular data access frameworks in Java: JDBC, iBatis, Hibernate, JDO, JPA, Oracle Top Link, Apache OJB, and Apache Cayenne, among others.
For all of these supported frameworks, Spring provides these features:
Resource management - automatically acquiring and releasing database resources
Exception handling - translating data access related exception to a Spring data access hierarchy
Transaction participation - transparent participation in ongoing transactions
Resource unwrapping - retrieving database objects from connection pool wrappers
Abstraction for BLOB and CLOB handling
All these features become available when using Template classes provided by Spring for each supported framework. Critics say these Template classes are intrusive and offer no advantage over using (for example) the Hibernate API.. directly. In response, the Spring developers have made it possible to use the Hibernate and JPA APIs directly. This however requires transparent transaction management, as application code no longer assumes the responsibility to obtain and close database resources, and does not support exception
translation.
Together with Spring's transaction management, its data access framework offers a flexible abstraction for working with data access frameworks. The Spring Framework doesn't offer a common data access API; instead, the full power of the supported APIs is kept intact. The Spring Framework is the only framework available in Java which offers managed data access environments outside of an application server or container. While using Spring for transaction management with Hibernate, the following beans may have to be configured.
Transaction management framework Spring's transaction management framework brings an abstraction mechanism to the Java platform. Its abstraction is capable of working with local and global transactions (local transaction does not require an application server).working with nested transactions working with transaction safe points working in almost all environments of the Java platform
In comparison, JTA only supports nested transactions and global transactions, and requires an application server (and in some cases also deployment of applications in an application server).
The Spring Framework ships a Platform Transaction Manager for a number of transaction management strategies:
Transactions managed on a JDBC Connection
Transactions managed on Object-relational mapping Units of Work
Transactions managed via the JTA Transaction Manager and User Transaction
Transactions managed on other resources, like object databases
Next to this abstraction mechanism the framework also provides two ways of adding transaction management to applications:
Programmatically, by using Spring's Transaction Template
Configuratively, by using metadata like XML or Java 5 annotations
Together with Spring's data access framework —which integrates the transaction management framework —it is possible to set up a transactional system through configuration without having to rely on JTA or EJB. The transactional framework also integrates with messaging and caching engines.
The BoneCP Spring/Hibernate page contains a full example project of Spring used in conjunction with Hibernate.
Model-view-controller framework The Spring Framework features its own MVC framework, which wasn't originally planned. The Spring developers decided to write their own web framework as a reaction to what they perceived as the poor design of the popular
Jakarta Struts web framework, as well as deficiencies in other available frameworks. In particular, they felt there was insufficient separation between the presentation and request handling layers, and between the request handling layer and the model.
Like Struts, Spring MVC is a request-based framework. The framework defines strategy interfaces for all of the responsibilities which must be handled by a modern request-based framework. The goal of each interface is to be simple and clear so that it's easy for Spring MVC users to write their own implementations if they so choose. MVC paves the way for cleaner front end code. All interfaces are tightly coupled to the Servlet API. This tight coupling to the Servlet API is seen by some as a failure on the part of the Spring developers to offer a high-level abstraction for web-based applications [citation needed]. However, this coupling makes sure that the features of the Servlet API remain available to developers while offering a high abstraction framework to ease working with said API.
The Dispatcher Servlet class is the front controller of the framework and is responsible for delegating control to the various interfaces during the execution phases of a HTTP request.
The most important interfaces defined by Spring MVC, and their responsibilities, are listed below:
Handler Mapping: selecting objects which handle incoming requests (handlers) based on any attribute or condition internal or external to those requests
Handler Adapter: execution of objects which handle incoming requests
Controller: comes between Model and View to manage incoming requests and redirect to proper response. It essentially is like a gate that directs the incoming information. It switches between going into model or view.
View: responsible for returning a response to the client. It is possible to go straight to view without going to the model part. It is also possible to go through all three.
View Resolver: selecting a View based on a logical name for the view (use is not strictly required)
Handler Interceptor: interception of incoming requests comparable but not equal to Servlet filters (use is optional and not controlled by Dispatcher Servlet).
Locale Resolver: resolving and optionally saving of the locale of an individual user
Multipart Resolver: facilitate working with file uploads by wrapping incoming requests Each strategy interface above has an important responsibility in the overall framework. The abstractions offered by these interfaces are powerful, so to allow for a set of variations in their implementations, Spring MVC ships with implementations of all these interfaces and together offers a feature set on top of the Servlet API. However, developers and vendors are。

相关文档
最新文档