毕业论文外文翻译-使用XML,Spring和struts以MVC为设计模式的多分布式应用程序框架.doc
本科生毕业设计 (论文)外 文 翻 译 原 文 标 题 MVC Design Pattern for the multi framework distributed applications using XML, spring and struts framework 译 文 标 题 使用XML,Spring和struts以MVC为设计模式的多 分布式应用程序框架 作者所在系别 计算机与遥感信息技术学院 作者所在班级 作 者 姓 名 作 者 学 号 指导教师姓名 指导教师职称 完 成 时 间 2015 年 1 月 北华航天工业学院教务处制译文标题使用XML,Spring和struts以MVC为设计模式的多分布式应用程序框架原文标题MVC Design Pattern for the multi frameworkdistributed applications using XML, spring and struts framework作 者Praveen Gupta译 名普利文·古塔国 籍印度原文出处 International Journal on Computer Science and Engineering使用XML,Spring和struts以MVC为设计模式的多分布式应用程序框架摘要:模型-视图-控制器(MVC)是一个基本的设计模式,用来分离用户界面与业务的逻辑。近些年来,应用程序的规模越来越大,而MVC设计模式可以弱耦合不同应用层的程序。本文提出了一种基于J2EE平台上的网络,它扩展了MVC、XML的应用程序框架,易于维护。这是一个包括表示层、业务层、数据持久层和数据库层的多系统层,由于其代码的具有独立性,可维护性和可重用性大大提升。在本文中,我们使用MVC实现spring和struts框架。我们的研究显示,应用多个框架设计应用程序时,使用MVC概念能使应用程序转变为更容易、较单一的框架。关键字:MVC,Spring,XML 一 介绍 近些年来,web是非常复杂的问题。因为公司和组织越来越多,不同类型的通讯设备也越来越多,特别当业务要求应用程序使用web和许多通信设备的时候,网络编程的性能越加重要。所以在互联网上,在增加负载的数据的同时,我们必须照顾体系结构的问题。让我们简要讨论到目前为止MVC的研究。 1.1没有MVC 在web开发的初始阶段,页面被用来设计html,其中Html是纯文本。这是第一个在互联网上工作的标记语言。今天仍然是基于块的所有互联网的编程语言。用户必须实现与静态页面交互,信息手动写在页面时必须改变。随着时间增长,语言和页面可以按照用户需求相互作用,页面也会有相应的变化。 1.2 MVC模式一 第一个重大变化是由于架构的流行,引入了MVC模式。这种具有控制演示、业务逻辑和流程的架构是以页面为中心,以Java语言为服务器的页面程序。逻辑就是在这个模型概念中介绍的。Java bean和scriptlet、表达式等业务逻辑都是以硬性编码的形式存在的。页面里的所有代码都是用jsp编写的。让我们假设,我们想传输基于我们收到数据时的jsp的情况。图一 页面导航MVC-1框架 1.3 MVC模式二 模型1架构能够解决一些网络和网络编程的问题,但仍有很多东西丢失。它是集中jsp页面的导航,从而能进一步发展的体系结构的观点。在这个过程中未来发展是Model 2架构。这个解决了一起使用Servlet和JSP的问题。能够服务处理初始请求和部分处理数据。它设置bean然后结果转发到一个jsp页面。Servlet决定从列表中显示一个页面到页面。图二 MVC-2框架在这个模型中2架构的JSP页面仅用于演示目的。业务逻辑已经从页面删除。这使页面更容易表示并且轻、重量级页面也很容易在互联网上显示。 在这个模型中所有的控制和应用程序逻辑都由Servlet处理。Servlet是用java编程语言编写的,所以它也是容易处理的Servlet的一部分。在这种情况下的服务成为全面完整的应用程序,它已成为应用程序的中心点。 在model 2架构中,Servlet成为所有常见任务的“看门人”。它提供了诸多公共服务,如身份验证、授权、错误控制和应用程序的循环。此体系结构解决了大部分的问题。但仍有许多新的问题出现在这个应用架构。二 应用架构与多个框架 在越来越多的网络和互联网领域,应用程序的需求正在增长。单独的一个框架是不能处理应用程序的体系结构的需求的。满足潮流要求的应用程序有必要设计一个完整的框架体系结构。 Struts框架设计和web应用程序的前端控制开发有着密不可分的联系。它为用户提供了各种功能交互的应用程序。它也遵循MVC 2设计特点。Spring框架是用来设计处理各种任务的。Spring的工作是基于互联网的应用程序。它遵循的原则MVC 2。 同时使用Struts和spring框架在单个应用程序应使用MVC设计主体,这样我们可以提高应用程序的性能。 Struts框架包括三个主要模块,简要描述如下:图三 Struts框架 第一个是使用块控制,以用来表示完整的模型的一部分。它包含自定义标记库,为我们编写JSP的特定应用程序提供了国际化资源文件。第二块是代表控制器。它是导航的完整应用程序,包含XML配置文件和含标签的导航路径。 第三块是模型。这部分工作主要是分析业务逻辑,抓取和存储数据到数据库中。它包含Java bean、 Enterprise和数据库。下图显示了struts框架中的组件工作。图一 struts框架组件 Struts中的MVC 在Spring框架中,MVC的主要表现在以下三个部分。控制器,Servlet控制器(部分);Java服务器页面(视图部件);应用程序业务逻辑,应用程序的形式(模型)。 Spring组件 在Spring里,我们也遵循MVC的原则。它被设计为基于互联网和桌面的应用程序。Spring包含三个核心组件。1,控制器:处理导航逻辑和交互与服务的业务逻辑层2,模型:控制器和视图之间的联系,包含由控制器渲染的视图和其所需的数据3,视图:根据用户请求,呈现从模型中获取数据。spring MVC核心组件如下。 1.DispatcherServlet:Spring的前端控制器实现。它是控制器进行交互的第一个请求。我们也可以说它是一个Servlet的实现。它控制应用程序的完整流程。 2.控制器:用户创建的组件来处理请求封装导航逻辑代表服务对象的业务逻辑。 3.视图:负责渲染输出。不同的视图可以在查看设备的基础上,选择不同类型的通信设备和输出结果。 ModelAndView:ModelAndView是spring框架的核心部分。它实现了应用程序的业务逻辑。它是由控制器控制。每当它执行时,都会存储业务逻辑和与之关联的视图。 ViewResolver:根据返回的结果,输出显示收到的ModelAndView。由逻辑视图名称映射到实际的视图是由它实现的。这部分标识时实现输出媒体是什么,以及如何显示该媒体。 HandlerMapping:该接口使用DispatcherServlet传入的请求映射到单个控制器。它标识请求,并调用相应的处理程序提供的服务。 下面的图显示了模型的作用。在这个dispatcher Servlet应用程序的入口点,Struts部分作为框架,而dispatcher Servlet用于发送请求。Servlet决定处理程序。那么它将调用控制器,控制器执行ModelAndView。图5 序列流应用程序的spring框架三 提出的方法 这种方法的组合应用为两个框架,struts和spring应用程序开发打下了基础。序列图的组合应用程序解释如上所述,这是应用程序的主要驱动力。要想使用这种方法,web应用程序的基本知识是必要的。我们已经测试了上述概念,找出它优点,上述体系结构的主要优点如下: 1.它将提供一个非常简洁的部分之间的行动,行动的形式,控制器,处理器,javabean模型和视图。 2.我们使用的优势是Spring MVC非常灵活。不像Struts,这迫使你的行动和表单对象具体的继承。 3.Spring MVC是完全基于接口。Spring MVC框架的每一部分是可配置的。 4.它提供了控制器,使其易于从用户界面处理的请求。 5.我们可以使用JSP或任何其他技术来显示视图,给用户的任何输出设备输出结果视图。 6.Spring配置控制器通过控制反转。这使其他对象由spring集成,于是它们更易于测试。 7.Spring MVC web层Struts web层相比,由于避免强迫继承和显式依赖dispatcher Servlet控制器,Spring MVC相对更好一些。 8.web层变成了薄层上的一个业务对象层,这鼓励良好的实践。 9.Struts框架的目的仅用于设计web界面。spring框架则是开发的桌面和网络应用程序。当两个框架结合,他的灵活性则将体现出来。四 总结 相比于单一框架,多框架体系结构更有效。为了发展的大规模应用程序,我们可以使用大规模的机械、提高大型数据库应用程序的性能,比如请求数量,请求处理的能力。多框架体系结构还将为公司和程序员开放新的范围和新的商业机会。所以建议使用多个框架以便能有更好的性能。由于框架代码结构过大,在此我们不予显示。五 未来研究 开放技术是吸引学术和研究学者的最好的方法。由于开放技术,现在是J2EE的广阔领域。技术的变化也使得架构不断的变化。有许多的框架可以使用J2EE技术,单独的某一个架构是从来不可能完成大规模的应用程序的。我们将努力工作,从而进一步实现和加强MVC架构。参考文献:1 Shu-qiang Huang, Huan-ming Zhang, ” Research on Improved MVC Design Pattern Based on Struts and XSL” , in Information Science and Engineering ISISE 08 International Symposium on, 2008, vol. 1 PP. 451 4552 Juanjuan Yan; Bo Chen; Xiu-e Gao, "Le Wang; Research of Structure Integration Based on Struts and Hibernate" , in 2009 WRI World Congress on Computer Science and Information Engineering,2009, vol. 7,PP. 530-5343 Wojciechowski, J.; Sakowicz, B.; Dura, K.; Napieralski, A.,"MVC model, struts framework and file upload issues in web applications based on J2EE platform", in Proceedings of the International Conference on Modern Problems of Radio Engineering, Telecommunications and Computer Science 2004, 2004, PP 342-3454 Erxiang Chen; Minghui Liu, "Research and Design on Library Management System Based on Struts and Hibernate Framework", in WASE International Conference on Information Engineering ICIE 09, 2009, Vol. 2,PP. 310-3135 Yonglei Tao; "Component- vs. application-level MVC architecture", in Frontiers in Education 2002 FIE 2002. 32nd Annual,2002, Vol 1,PP. T2G-7 - T2G-106 Meiyu Fang, "Design and Implement of a Web Examination System Using Struts and EJB" ,Seventh International Conference on in Web-based Learning 2008, 2008,pp. 25-287 Wang Ning; Li Liming; Wang Yanzhang; Wang Yi-bing; Wang Jing,"Research on the Web Information System Development Platform Based on MVC Design Pattern",in IEEE/WIC/ACM International Conference on Web Intelligence and Intelligent Agent Technology, 2008 , Vol 3,pp. 203-206作者简介 Praveen古普塔是,印度,那格浦尔那格浦尔大学电子工程工程学士,他掌握技术在信息技术从印度旁遮普大学。他在印度孟买一家软件公司担任技术主管。他是计算机电子和电气工程师协会(美国节能经济委员会)的一个研究学者,追求印度拉贾斯坦邦Pacheri巴里Singhania大学的博士学,。他的主要研究兴趣包括:MVC,Java设计模式和框架。 Govil获得了博士学位。他的工作是印度阿杰梅尔女性工程学院的教授和政府负责人。他有超过20年的教育和研究经验并且已经发表了很多篇论文。他的研究兴趣包括通信、网络技术、软件工程等。附件(外文原文)MVC Design Pattern for the multi framework distributed applications using XML, spring and strutsPraveen GuptaResearch Scholar, Singhania UniversityPacheri Bari, Rajasthan, Indiapraveen2gupta Abstract The model view controller (MVC) is a fundamental design pattern for the separation between user interface logic and business logic. Since applicationsare very large in size these days and the MVC design pattern can weak the coupling among the different application tiers of application. this paper presents a web application framework based on MVC in J2EE platform, and extends it with XML so that the framework is more flexible, expansible and easy to maintain. This is a multitier system including presentation layer, business layer, data persistence layer and database layer. This separate codes, and improve maintainability and reusability of the application. In this paper, we implemented MVC using spring and struts framework. Our research study show that applying multiple framework to design the applications using MVC concepts makes applications easier compare to a single framework.Index Terma: MVC, Spring, XMLI. INTRODUCTION Web 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 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 in brief the research done so far in MVC. 1. 1 NO MVC : In The initial phase of the web development the pages were used to be designed in the html. Html is the plain text only. This was the first markup language which can work on the internet. And today stills it works as building block for the all Internet based programming languages. The user has to interact with the static pages. The information written on the pages had to change manually. As the time grows the demand arises for a language that can interact with the user and page can be changed as per the requirement of the user.1.2 MVC Model 1: The first major change in the architecture comes with the introduction of the MVC Model 1 Architecture. This architecture was completely based on the page centric approach. In this model a Java Server Pages to program to control the Presentation, Business Logic and flow of the program. In this model the concept of the Business Logic was introduced. The business logic was hard coded in the form of the Java Beans and scriptlets and expressions. All this codes was used to write within the JSP page. Let us assume a case when we want to transfer the flow of the jsp application based on the data we received from the input. 1.3 MVC Model 2 : The model 1 architecture was able to solve some of the problem of the web and internet programming but still there were a lot of things missing from it. It was centered on the navigation of the jsp pages so there was the scope of the further development in the architecture point of view. During this process the next development was the Model 2 architecture. This problem was solved using the Servlet and JSP together. The Servest handles the Initial request and partially process the data. It set up the beans then forward the result to the one of the jsp page. The Servlet decide the one of the page to be displayed from the list of pages. In this Model 2 architecture the JSP Pages were used to Presentation purpose only. The Business logic has been removed from the page. This makes the pages easier to represent and light weight pages which were easy to display on the internet. In this model all Control and application logic were handled by the Servlet. The Servlet was written in the java programming language. So it was also easier to handle the programming part of the Servlet. In this scenario the Servest becomes the power full for the complete application and It has emerged as the center point for the application. In the model 2 architecture the Servlet becomes the gatekeeper for the all common tasks. It provides the common services like authentication, authorization, error control and follow of the application. This architecture have solved the most of the problems. But still there were many new issues emerged while applying this architecture.II. APPLYING ARCHITECTURE WITH MULTIPLE FRAMEWORKS Web and Internet is ever growing area and the demands for the applications are growing. A single framework is not capable to handle the architecture of the application. To meet the currents requirement of the applications its necessary to design a architecture to implement the frameworks. Struts framework have been designed and developed for the front end control of the web applications. It provides the various features for the applications that interact to the users. It also follows the MVC 2 design features. Spring Framework is the designed to handle the various tasks. The spring work for the desktop and internet based applications also. It follows the principals of the MVC 2.The simultaneous use of the Struts and spring frameworks in the single application with the applying the MVC Design principals so that we can Improve the performance of the applications. Struts Framework consists of three major blocks, Described in brief as follows: First is The View Block which controls the presentation part of the complete model. This contains following JSP files which you write for your specific application Set of JSP custom tag libraries Resource files for internationalization. Second Block is representing the Controller. This is for navigation the complete application. This contains XML configuration files; it contains the tags for the navigation of the paths. Third Block is the Model. This part do the work of the Business Logic, Fetching and storing data to the database.This contains following Java Beans Enterprise Java Beans Database. Following figure shows the working of the components in the struts framework. MVC in Struts The major three parts of the MVC are as follows in the spring framework. Servlet controller (Controller Part) Java Server Pages or any other presentation technology (View Part) Application Business Logic: in the form of whatever suits the application (Model Part). SpringComponents. In the spring we also follows 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 logic 2. Model: The contract between 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. DispatcherServlet: Springs Front Controller implementation. It is the first controller which interacts to the requests. We can also say it is an implementation of the Servlet. It controls the complete flow of the application. 2. Controller: User created component for handling requests encapsulates navigation logic delegates to the service objects for business logic. 3.View: Responsible for rendering output. Different views can be selected for the different types of output bases on the results and the viewing device, communication devices. 4.ModelAndView: ModelAndView is the core part of the spring framework. It implements the business logic of the application. It is controlled by the controller. It stores the business logic and the view associated with it. Whenever it is executed it will the data with the name of the 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