jsp学生成绩管理系统毕业设计外文文献原文及译文_第1页
jsp学生成绩管理系统毕业设计外文文献原文及译文_第2页
jsp学生成绩管理系统毕业设计外文文献原文及译文_第3页
jsp学生成绩管理系统毕业设计外文文献原文及译文_第4页
jsp学生成绩管理系统毕业设计外文文献原文及译文_第5页
已阅读5页,还剩2页未读 继续免费阅读

下载本文档

版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领

文档简介

1、毕业论文外文文献原文及译文计算机科学与技术学生姓名: 学号: 计算机科学与技术系 别: 专 业: 指导教师: 2012年 6 月一种基于hibernate和struts的j2ee应用开发策略本文分析了hibernate和struts的机制,提出了一种基于hibernate和struts的j2ee应用开发策略。在这种策略中,模型层用hibernate实现,视图和控制器则用struts框架实现。这样可大大降低代码的耦合性以及提高系统的开发效率。 关键字:hibernate,struts,mvc,持久层 1. 引言 随着java技术的逐渐成熟与完善,作为建立企业级应用的标准平台,j2ee平台得到了长

2、足的发展。借助于j2ee规范中包含的多项技术:enterprise javabean(ejb)、java servlets(servlet)、java server pages(jsp)、java message service(jms)等,开发出了许多应用系统。但是,在传统j2ee应用的开发过程中也出现了一些问题: 1)数据模型和逻辑模型之间的矛盾。目前使用的数据库基本上都是关系型数据库,而java本质上是一种面向对象的语言,对象在存储和读取时使用sql和jdbc进行数据库操作,降低了编程的效率以及系统的可维护性; 2)传统的j2ee应用多采用基于ejb的重量级框架,这种框架适合于开发大型企

3、业应用,但是使用ejb容器进行开发和调试需要耗费大量时间。为了降低代码的耦合性,提高系统的开发效率,本文提出了一种基于struts框架和hibernate框架的j2ee应用开发策略。 2 数据持久层及hibernate hibernate是一个数据持久层框架,是一种实现对象和关系之间映射(o/r mapping)的工具,它对jdbc进行了轻量级的对象封装,使程序员可以使用对象编程思想来操作数据库。它不仅提供了从java类到数据表的映射,也提供了数据查询和恢复机制。相对于使用jdbc和sql来操作数据库,使用hibernate能大大的提高实现的效率。hibernate框架用配置文件的形式来定义j

4、ava对象和数据表之间的映射关系,同时在更深的层面将数据表之间的关系解释为java对象之间的继承及包含等关系。通过使用hql语句将复杂的关系算法用对象的方式描述,在很大程度上简化了对数据的查询,加快了开发的效率。在hibernate中有一个简单而直观的api,用于对数据库所表示的对象执行查询。要创建或修改这些对象,只需在程序中与它们进行交互,然后告诉hibernate保存即可。这样,大量封装持久化操作的业务逻辑不再需要编写烦琐的jdbc语句,从而使数据持久层得到了极大的简化。 3 用struts实现mvc架构 mvc(model-view-controller)由trygve reenskau

5、g提出,首先被应用在smalltalk-80环境中,是许多交互和界面系统的构成基础。根据界面设计可变性的需求,mvc把交互系统的组成分解成模型、视图、控制器三部分。 模型(model)是软件所处理问题逻辑在独立于外在显示内容和形式情况下的内在抽象,封装了问题的核心数据、逻辑和功能的计算关系,独立于具体的界面表达和i/o操作。视图(view)把表示模型数据及逻辑关系和状态的信息及特定形式展示给用户。它从模型获得显示信息,对于相同的信息可以有多个不同的显示形式或视图。控制器(controller)是处理用户与软件的交互操作的,其职责是控制提供模型中任何变化的传播,确保用户界面于模型间的对应联系;它

6、接受用户的输入,将输入反馈给模型,进而实现对模型的计算控制,是使模型和视图协调工作的部件。通常一个视图对应一个控制器。模型、视图与控制器的分离,使得一个模型可以具有多个显示视图。如果用户通过某个视图的控制器改变了模型的数据,所有其它依赖于这些数据的视图都应反映到这些变化。因此,无论何时发生了何种数据变化,控制器都会将变化通知所有的视图,导致显示的更新。这实际上是一种模型的变化-传播机制。 struts框架最早是作为apache jakarta项目的组成部分问世运做,它继承了mvc的各项特性,并根据j2ee的特点,做了相应的变化与扩展。struts框架很好的结合了jsp,java servlet

7、,java bean,taglib等技术。在struts中,承担mvc中控制器角色的是actionservlet。actionservlet是一个通用的控制组件。这个控制组件提供了处理所有发送到struts的http请求的入口点。它截取和 分发这些请求到相应的动作类(这些动作类都是action类的子类)。另外控制组件也负责用相应的请求参数填充action form(frombean),并传给动作类(actionbean)。动作类访问核心商业逻辑,即访问java bean或调用ejb。最后动作类把控制权传给后续的jsp文件,由jsp文件生成视图。所有这些控制逻辑利用struts-config.x

8、ml文件来配置。在struts框架中,视图主要由jsp生成页面完成,struts提供丰富的jsp标签库,这有利于分开表现逻辑和程序逻辑。模型以一个或多个java bean的形式存在。在struts中,主要存在三种bean,分别是:action,actionform,ejb或者java bean。 struts框架没有具体定义模型层的实现,在实际开发中,模型层通常是和业务逻辑紧密相连的,并且要对底层数据进行操作。下面介绍一种开发策略,将hibernate引入到struts框架的模型层中,使用它来进行数据封装和映射,提供持久化的支持。 4 运用hibernate和struts开发j2ee应用以在j

9、2ee应用中非常普遍的用户登录过程为例,来说明上述体系结构是如何具体运用的。登录的流程非常清晰:用户从登录页面login.jsp输入登录信息,系统对登录信息进行验证,如果正确则成功登录,否则提示相应错误信息。在开发过程中,使用eclipse做为开发环境,同时加载了对struts及hibernate提供更好的控制和支持的第三方插件myeclipse,web服务器使用tomcat,数据库选用了mysql。 首先对hibernate进行配置,只需要对系统自动生成的hibernate.cfg.xml进行修改,配置好数据库连接的各种参数以及定义数据映射文件。由于hibernate所带的连接池主要用于测试

10、,性能不是很好,可以通过jndi将其修改为使用tomcat的连接池。a development strategy application based on the hibernate and the struts j2eethis text analysis the mechanism of hibernate and struts, put forward 1 kind ee according to the j2 of the hibernate and the struts application development strategy.in this kind of strategy

11、, the model layer use a hibernate realization and see diagram and controller to then use a struts frame a realization.so can consumedly lower the development efficiency that the ou of code match sex and exaltation system. the key word : hibernate, struts, the mvc, hold out for long time 1.one prefac

12、e along with the java technique of gradual mature and perfect, beestablishment business enterprise class application of standard terrace, the jee terrace got substantial of development .several technique asked for help from to include in the j2 ee norm : enterprise javabean (ejb), java servlets (ser

13、vlet), java server pages(jsp), java message service(jms).etc., development many application system.but, also appeared some problem in the tradition j2 the ee the application of the development the process: 1)the antinomy of of data model and logic model. currently the database of usage basically and

14、 all is relation type database, but the java be essentially a kind of the language which face to object, object at saving with read usage sql and jdbc carry on a database operation and lowered plait distance of efficiency and system of can maintenance; 2)tradition of j2 ee application much the adopt

15、ion is according to the ejb heavy weight frame, this kind of frame suitable for develop a large business enterprise application, but usage the ejb container carry on development and adjust to try to need to be waste a great deal of time.for lowering the ou of code to match sex,exaltation system of d

16、evelopment efficiency, this text put forward 1 kind ee according to the j2 of the struts frame and the hibernate frame application development strategy. 2. datas holding out for long time layer and hibernate is one piece according to hold out for long time layer frame, is a kind of realization objec

17、t and relation of the tool which reflect to shoot(o/r mapping), it carried on the object of the lightweight to pack to the jdbc and make procedure member can usage object plait distance thought to operation database. it not only provided to shoot from java to reflect of data form, but also provided

18、a data a search and instauration mechanism. opposite in usage jdbc and sql to operation database, use hibernate ability consumedly of exaltation realization of efficiency. the hibernate frame use allocation document of the form come to the reflect of the definition java object and data form to shoot

19、 relation, in the meantime at more deep of level of data form of relation explanation for the relations such as inherit of and containment etc. of java object. pass the usage hql language sentence complications of relation the calculate way use the way of object description, to a large extent simpli

20、fication logarithms according to of search, speed development of efficiency. have in the hibernate a simple but keep the api of view, used for to the database mean of object performance search. want to establish or the modification be these objects, need in the procedure carry on with them to hand o

21、ver with each other, then tell hibernate to keep. so, a great deal of pack hold out for long time turn operation of business logic no longer demand write a trivial jdbc language sentence, make data last long thus the layer got biggest of simplification. 3. use the struts realization mvc structure mv

22、c(model-view-controller) is put forward by the trygve reenskaug, first drive application in the environment smalltalk-80, is many to hand over with each other with interface system of constitute foundation. according to the need of variable of the interface design, mvc hand over with each other cons

23、titute of system to resolve into model and see diagram, controller three part. model(model) is software processing problem logic at independence in outside manifestation under contents and form circumstance of inside abstract, packed the core data, logic of problem and function of calculation relati

24、on, independence in concrete of interface expression and i/o operation. see diagram(view) mean information and particular form demonstration of model data and logic relation and appearance to the customer. it acquire a manifestation 14 information from the model, there can be many for homology of in

25、formation dissimilarity of manifestation form or see diagram. the controller(controller) is a processing the customer hand over with software with each other operation of, its job is control provide model in any variety of dissemination, insure a customer interface among the model of rightness shoul

26、d contact; it accept a customer of importation, give the importation feedback model, then realization compute model control, is make model and see diagram to moderate work of parts. usually 1 see a diagram rightness should a controller. model, see separate of diagram and controller, make a model be

27、able to have many manifestation to see diagram. if the customer pass a certain see the controller of diagram change the data of model, all other dependence in these see of data diagram all should reflection arrive these variety. when therefore and regardless occurrence what data variety, controller

28、all would variety notice ally see diagram, cause manifestation of renewal. this is actually a kind of variety of model-dissemination mechanism. the struts frame is to be the item of apache jakarta to constitute part to publish luck to do at the earliest stage, it inherited mvc of each item character

29、istic, and did according to the characteristics of j2 ee correspond of variety with expand. the struts frame was good to combine jsp , java servlet , java bean, talia etc. technique. in the struts, what to undertake the controller role in the mvc be an actionservlet. the actionservlet is an in gener

30、al use control module. this control module provided a processing all http claim which send out struts of entrance point. its interception with distribute these claim to arrive correspond of action type.(these action all of type is action son type)moreover the control module is also responsible for u

31、sing to correspond of claim the parameter fill action form(frombean), and pass action type(actionbean).action type the business logic of the interview core, then interview java bean or adjust to use ejb. end action type control the power pass follow-up of jsp document, from jsp document born see dia

32、gram. all these control logic make use of struts-config.xml the document come to allocation. see diagram in the struts frame main from jsp born page completion, the struts provide abundant of jsp label 15 database, this is advantageous to separating performance logic and procedure logic.the model is

33、 with 1 or the form existence of several java bean. in the struts, main existence three kinds of bean, respectively be: action, actionform, ejb perhaps java bean. the struts frame have no concrete definition model layer of realization, in actually the development, model layer usually is close with b

34、usiness logic connect with each other, and want to carry on operation to the first floor data. the underneaths introduction is a kind of development strategy, lead the hibernate into the model layer of struts frame, usage it to carry on a data to pack with reflect to shoot, provide hold out for long time turn of support. 4 usage hibernate and the struts development j2 ee application 4.1 system structure diagram 3 manifestation according to hibernate and struts development strategy of system structure diagram

温馨提示

  • 1. 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。图纸软件为CAD,CAXA,PROE,UG,SolidWorks等.压缩文件请下载最新的WinRAR软件解压。
  • 2. 本站的文档不包含任何第三方提供的附件图纸等,如果需要附件,请联系上传者。文件的所有权益归上传用户所有。
  • 3. 本站RAR压缩包中若带图纸,网页内容里面会有图纸预览,若没有图纸预览就没有图纸。
  • 4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
  • 5. 人人文库网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对用户上传分享的文档内容本身不做任何修改或编辑,并不能对任何下载内容负责。
  • 6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
  • 7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。

评论

0/150

提交评论