外文翻译模板(19页).doc

上传人:1595****071 文档编号:37332829 上传时间:2022-08-30 格式:DOC 页数:19 大小:199.50KB
返回 下载 相关 举报
外文翻译模板(19页).doc_第1页
第1页 / 共19页
外文翻译模板(19页).doc_第2页
第2页 / 共19页
点击查看更多>>
资源描述

《外文翻译模板(19页).doc》由会员分享,可在线阅读,更多相关《外文翻译模板(19页).doc(19页珍藏版)》请在得力文库 - 分享文档赚钱的网站上搜索。

1、-外文翻译模板-第 10 页毕业设计(论文)外文文献翻译院 系:计算机与信息工程学院年级专业:姓 名:学 号:附 件:Spring Web Mvc Framework for Rapid OpenSource J2EE Application Development 指导老师评语: 指导教师签名:年 月 日运用spring mvc框架进行快速的开源J2EE应用程序开发:案例研究摘要当今,web应用程序的开发竞争非常激烈,时代要求开发出的应用程序非常准确、经济和高效。人们致力于开发出能提高生产效率和降低复杂性的应用程序,转变程序员开发java2平台企业版的web应用程序的方法已经成为一个基本的运

2、动。本文中我们讨论的重点是怎样开发出j2ee兼容的软件而无需使用企业java bean(EJB)。最好的选择之一就是运用spring框架, spring框架提供了许多服务,但是相比于EJB,它的侵入性大大降低了。这种转变背后的驱动力是web应用程序开发和实施领域提高生产率和降低复杂性的需要。本文中,我们将简要介绍spring的基本体系结构并且给出一个运用了spring mvc框架的案例研究实例。关键词:mvc,spring,xml、简介现今,网络问题是非常复杂的。由于公司和组织的需求都在不断的增加,应用程序开发的复杂性和系统性能是需要解决的主要问题。不同类型的通讯设备的复杂性在不断增加,而业务

3、要求应用程序使用网络和许多通讯设备,并且互联网上数据负载不断的增加,这些迫使我们不得不考虑起应用程序的体系架构问题。现在,让我们讨论在保持应用程序模型视图结构不变的情况下,spring web mvc快速应用程序开发框架是如何快速工作的。Spring框架具有丰富的功能集,我们将简要讨论这些功能。1.控制反转:控制反转,即IOC。它是有线服务或者将组件添加到应用程序所使用的技术之一。IOC是“一种软件设计模式和相关的编程技术集”,与传统的交互模式相比,运用IOC后,系统的控制流是反向的。在IOC容器内不是应用程序调用框架而是框架调用应用程序指定的组件。IOC可以被解释为“把运行时所需要的资源或者

4、依赖注入到相关的资源中去”,这也被称为依赖注入。org.springframework.beans.factory.BeanFactory是spring IOC容器的实际表现,它是负责控制和管理bean的。BeanFactory接口是spring IOC容器的主要接口。Bean就是由spring IOC容器实例化和管理的对象。这些bean和他们之间的依赖关系反应在容器所使用的配置元数据中。2.构造函数依赖注入:我们可以使用java类的构造函数来加载bean的值。首先定义一个只有单一构造函数的类,然后使用details.xml文件提供构造函数所需要的值,最后用一个实现了beanfactory接口

5、方法的类来加载xml文件。这是使用xml文件把值加载到java文件的构造函数中,这种方法适用于向构造函数传递值。3.Setter依赖注入:给每一个bean定义其get和set方法。我们可以利用set方法在设定bean中的值。Set方法会覆盖掉从bean中加载的值。4.接口:我们可以在spring中定义接口类。为了实现这一点,必须为java程序导入接口,然后我们可以利用接口中定义的方法来使用spring和xml文件。5.继承:一个java类可以获得另一个java类的属性,就像只有一个java程序一样。继承有三种子类型:1)抽象型:spring中定义成抽象类的bean只能被继承。2)父子型:定义的

6、的继承层次结构想父子关系一样。3)父- 子 孙子型:这种类型的继承关系可以定义3个或者更多的类层次结构。6.自动装配:自动装配用于将xml文件中属性的键和值映射到java文件中去。有4种装配的类型:byName(通过名字)、byType(通过类型)、constructor(通过构造函数)、autodetect(自动检测)。如果没有定义装配的类型,那么默认是以通过名字的方式来装配的。7.Bean的作用域:spring中定义的所有bean有四种类型的作用域,即session,request,singleton,global-session。这些是用来控制bean的访问范围的。8.引用bean:在x

7、ml文件中的一个bean可以从其他的bean分配值。这尝尝用于从一个bean中读取值然后再分配给另一个bean。、spring的主要组件Spring框架依然遵循mvc的思想原则。它是为桌面应用和基于互联网的应用而设计的。Spring由三个相互协作的核心组件组成。1、控制器:处理业务逻辑中的跳转逻辑和同服务层的交互。2、模型:控制器和视图之间的桥梁,包含着控制器给予视图所需要的数据。3、视图:呈现请求后的响应,从模型中提取数据。Spring的核心组件如下所示:1.DispatcherServlet:它是spring的前端控制器的实现。Web.xml接收请求并且把它转移到DispatcherSer

8、vlet,DispatcherServlet是与请求进行交互的第一个控制器,它也被称为Servlet的执行。它控制着应用程序的完整流和跳转流。2.控制器:这个是使用者为了处理请求而创建的组件,它封装了跳转逻辑。控制器将服务委托给服务对象。3.视图:视图是负责渲染呈现输出的。在输出的结果集、显示设备和通讯设备的基础上,不同类型的输出要选择不同的视图。4.ModelAndView:ModelAndView是spring框架的核心部分。它实现了应用程序的业务逻辑,由控制器创建。它使视图和请求联系起来并且存储了业务逻辑和模型数据。当一个控制器调用它的时候,它才会执行。在执行时,它将返回视图的数据和名字

9、。5.ViewResolver:输出是如何显示的取决于从ModelAndView中接收的结果。ViewResolver是将逻辑视图名映射到实际视图的实现。这部分将确定和实现输出的是什么媒体以及如何去显示它。6.HandlerMapping:它是DispatcherServlet将传入的请求映射到单个控制器时所使用的战略性接口。它识别请求并且调用相应的处理程序来提供服务,处理程序会调用控制器。、spring的体系结构Spring框架为开发web应用程序提供了功能全面的mvc模型。Spring具有可插拨的mvc架构,他可以配置多种视图技术,例如:jsp、velocity、tiles、iText等等

10、。Spring mvc分离了控制器,模型对象,分派器和处理对象的角色。对象和控制器的清楚分离,使他们更容易进行定制。图01显示了执行流程。图01下面的图02显示了spring模型的序列图。图中dispatcher Servlet是应用程序的入口点,一旦dispatcher Servlet获取请求服务,它就会决定处理程序。所有的处理程序和servlet都是相互映射的。处理程序开始运行和调用相应的控制器,并且将请求的参数传递给控制器,这个时候控制器开始工作,它包含了业务逻辑,同时ModelAndView与控制器关联起来,在执行时,控制器会把ModelAndView返回给dispatcher Ser

11、vlet,这个时候的ModelAndView包含了数据 和视图名。Dispatcher Servlet从控制器从获得ModelAndView,然后Servlet会调用相应的视图解析器。视图解析器会识别出视图的名称并且通过视图名来提取相应的数据,最后,它会以适当的格式向用户呈现各自的数据。图02spring框架中应用程序的流程、spring和xmlXml广泛使用在spring框架中,它简化了开发流程,节约了时间。Xml用于存储在应用程序执行时所需要的一些数据。Web.xml文件是应用程序的入口点,它会告诉你进一步的跳转路径。它负责加载应用程序上下文并且指定了负责调度servlet的xml文件名。

12、web.xml:-web-app version=1.0 xmlns=http/xmlns:xsi=http:/www.w3.org/2001/XMLSchema-instancexsi:schemalLocation= org.springframework.web.context.ContextLoaderListenerdispatcherorg.springframework.web.servlet.DispatcherServlet1dispatcher/send/*index.jsp以上就是xml文件,xml将与传入到服务器的请求经行交互。xml文件中明确了要调度的servlet的

13、名称,应用程序上下文和index.jsp作为欢迎页面。url的类型定义为*.*,这意味着它将会接受任意类型的传入请求。ApplicationContext.xml ApplicationContext建立在BeanFactory之上,它使AOP特征、消息资源处理和事件传播更容易集成在一起。 BeanFactory提供了框架的配置和基本的功能,ApplicationContext则大大提高了应用的性能。当在j2EE的环境下开发应用程序,ApplicationContext是必不可少的。上述文件将加载superclass.java(超类)的bean和superclass.java本身,同时它还定义

14、了参考类。Dispatcher-servlet.xml- spring的web mvc框架是一个以请求为驱动的web mvc框架,它是围绕一个servlet设计的,该servlet将请求转发给控制器并且为处理应用程序提供了大量的功能。DispatcherServlet与spring的应用程序上下文完全集成在一起并且允许你使用spring的功能,它是应用程序运作的中央控制单元。DispatcherServlet定义了视图解析器、bean类以及他们的在应用程序中的映射。/WEB-INF/views/.jspdispatchController、spring是如何快速运作的快速应用程序开发一直以来是

15、行业的要求。目前有很多开发工具来帮助快速应用程序开发,但是随着技术和需求的持续增加,能够解决开发规模不断扩大的应用程序的工具和架构是急需的。工具不同于架构,spring是mvc架构中的一种架构,它可以支持规模较大的应用程序。这种技术和架构一旦实现,它很容继承其它的应用程序而不触及现有的代码。Spring使用xml文件来帮助我们添加新的映射、请求、java bean等等到应用程序中去。、架构的优点让我们看看spring mvc架构可以为一个项目带来哪些架构上的好处。1.spring可以有效的组织程序的中间层对象,而EJB则不会影响它。Spring的配置管理服务可以运用在任何架构层和任何运行时环境

16、中。2.spring web mvc框架是一个强大的,灵活的,精心设计的应用程序框架,用于使用mvc设计模式快速的开发web应用程序。3.spring消除了单例模式的扩散,这是一个主要的问题,它减少了程序的可测试性和面向对象性。4.清晰的角色划分:spring mvc很好的将组成web框架的各个组件所扮演的角色划分开。所有的组件,例如控制器、命令对象、设置器等,每个组件都扮演着独特的角色。5.适配控制器:如果你的应用程序不需要一个html表单,你可以写一个简单的版本的spring控制器,该控制器不需要表单控制所需要的的所有额外的组件。Spring提供了几种类型的控制器,每一种控制器用于不同的用

17、途。6.Spring不再需要使用各种自定义属性文件格式,在整个应用程序和项目中配置操作始终是一致的。7.Spring提供了良好的编程习惯来降低编程接口的成本,而不是类的成本。8.用spring构建的应用程序尽可能少的依赖于它的API,在spring的应用程序中大多数的业务对象都没有依赖于spring。9.使用了spring构建的应用程序是非常容易进行单元测试的。10.Spring可以使用EJB来实现选择,而不是决定应用程序的架构。11.你可以选择POJO或者本地EJB实现业务接口,而不影响代码的调用。12.Spring提供了EJB的一个替代品,这种适合很多应用程序。它可以在不使用EJB容器的情

18、况下使用AOP提供声明式事务管理。13.无论是使用JDBC或者hibernate的O/R映射时,spring提供了一致的数据访问框架。同时,它也提供了一致的和简单的编程模型,例如JDBC,JMS,JavaMail,JNDI和许多的api,这些使得spring是一个理想的架构。14.它是使用POJO创建应用程序的框架,同时它也掩盖了开发程序的复杂性。15.当在使用JDBC时,spring解决了连接泄露的问题,我们只需要编写必要的SQL,它也解决了数据库返回错误的问题。、总结Spring web mvc框架是一个在快速应用程序开发的环境下为应用程序提供环境的框架。在此框架下,我们可以信赖应用程序的

19、一致性,性能和稳定性。由于这是一个开放源码的环境,所以建议开发者继续使用这种技术用于大尺寸的web应用程序环境。Spring Web MVC Framework for rapid open source J2EE application development: a case studyPraveen GuptaResearch Scholar, Singhania UniversityPacheri Bari, Rajasthan, IndiaProf. M.C. GovilGovt. Mahila Engineering CollegeAjmer, Rajasthan, IndiaAbs

20、tract Today it is the highly competitive for the development of Web application, it is the need of the time to develop the application accurately, economically, and efficiently. We are interested to increase productivity and decrease complexity. This has been an underlying theme in a movement to cha

21、nge the way programmers approach developing Java 2 Platform, Enterprise Edition (J2EE) Web applications. Our focus is how to create J2EE-compliant software without using Enterprise Java Beans (EJB). The one of the best alternative is the Spring framework, which provides less services but it is much

22、less intrusive than EJB. The driving force behind this shift is the need for greater productivity and reduced complexity in the area of Web application software development and implementation. In this paper, we briefly describe spring underlying architecture and present a case study using Spring web

23、 MVC Framework.Index Terma: MVC, Spring, XMLI. INTRODUCTIONWeb is the very complex issues these days. Since the desire of the companies and organizations are increasing so the complexity and the performance of the web programming matters. Complexity with the different types of communication devices

24、is increasing. The business is demanding applications using the web and many communication devices. So with the increase load of the data on the internet we have to take care of the architecture issue. Let us discuss how it works fast using spring web mvc framework the rapid application development

25、while maintaining the Model View Architecture of the application. Spring frameworks comes with rich set of features, let us discuss these features in brief.1. Inversion Of Control: Inversion of Control or IoC is one of the techniques used to wire services or components to an application program. The

26、 IoC is “A software design pattern and set of associated programming techniques in which the flow of control of a system is inverted in comparison to the traditional interaction mode.” In IoC instead of an application calling the framework, it is the framework that calls the components specified by

27、the application. The IoC can be explained as Injection of required resources or dependency at run-time into the dependent resource which is also known as Dependency Injection. The org.springframework.beans.factory.BeanFactory is the actual representation of the Spring IoC container which is responsi

28、ble for containing and managing the beans. The BeanFactory interface is the central IoC container interface in Spring. A bean is simply an object that is instantiated and managed by a Spring IoC container. These beans and the dependencies between them are reflected in the configuration metadata used

29、 by a container.2. Constructor Dependency Injection: we can use the java class constructor to load the bean values. A java Class is defined with a constructor of single field. Details.xml file provides the value to be passes to the constructor. Now another java loads the xml file using the BeanFacto

30、ry Method. This uses the xml file to load values in the constructor of the java file. This is used to pass values to the constructor.3. Setter Dependency Injection: With every bean we defined the getters and setters. We can also use setters method to set the values in the beans. setters method overr

31、ides the values loaded from the beans.4. Interface: we can define the interface class in spring. To implement this we will import interface to the java program. Now we can use methods defined in interface using spring and xml.5. Inheritance: One java class can acquired the properties of another clas

32、s just like a java program. There are three sub types of it. 1. Abstract: Beans declared abstract cannot be inherited in the springs. 2. Parent Child: we can define hierarchy like parent child. 3. Parent - Child - Sub Child Relationship: in this we can define hierarchy for 3 or more classes.6. Autow

33、iring: Autowiring is used to map the property name, values in xml file with java file. There are four types to integrate it. byName, byType, constructor, autodetect. If nothing is defined about it then byName is the default.7. Scope of Beans: All beans defined in spring are having scope of four valu

34、es prototype, session, request, singleton,global-session. This is used to control the access of the beans.8. Reference Beans: One bean in the xml file can be assigned values from the other bean. This is used to read values from one bean and assign to another bean.II. MAJOR SPRING COMPONENTSIn the sp

35、ring we also follow the principals of the MVC. It has been designed more for the desktop and internet based applications. Spring consist of three core collaborating components. 1. Controller: Handles navigation logic and interacts with the Service tier for business logic2. Model: The contract betwee

36、n the Controller and the View Contains the data needed to render the View Populated by the Controller 3. View: Renders the response to the request Pulls data from the model. Core components in the spring MVC are as follows.1. DispatcherServlet: this is the springs front controller implementation. We

37、b.xml receives the request and transfer it to the DispatchServlet. This is the first controller which interacts to the requests. It is also known as implementation of the Servlet. It controls the complete flow of the application and navigates the flow of application.2. Controller: this is the user c

38、reated component for handling requests. It encapsulates the navigation logic with it. Controller delegates the services for the service object.3. View: view is responsible for rendering output. Different views can be selected for the different types of output bases on the results and the viewing dev

39、ice, communication devices.4. ModelAndView: ModelAndView is the core part of the spring framework. It implements the business logic of the application. It is created by the controller. It associates the view to the request. It stores the business logic and Model data. A controller calls it and it wi

40、ll execute. On execution it will return the data and name of view.5. ViewResolver: How the output is to be displayed depends on the result received from ModelAndView. It is used to map logical view names to actual view implementations. This part identifies and implement what is the output media and how to display it.6. HandlerMapping: Strategy interface used by DispatcherServlet for mapping incoming requests to individual Controllers. I

展开阅读全文
相关资源
相关搜索

当前位置:首页 > 教育专区 > 高考资料

本站为文档C TO C交易模式,本站只提供存储空间、用户上传的文档直接被用户下载,本站只是中间服务平台,本站所有文档下载所得的收益归上传人(含作者)所有。本站仅对用户上传内容的表现方式做保护处理,对上载内容本身不做任何修改或编辑。若文档所含内容侵犯了您的版权或隐私,请立即通知得利文库网,我们立即给予删除!客服QQ:136780468 微信:18945177775 电话:18904686070

工信部备案号:黑ICP备15003705号-8 |  经营许可证:黑B2-20190332号 |   黑公网安备:91230400333293403D

© 2020-2023 www.deliwenku.com 得利文库. All Rights Reserved 黑龙江转换宝科技有限公司 

黑龙江省互联网违法和不良信息举报
举报电话:0468-3380021 邮箱:hgswwxb@163.com