使用XML,Spring和struts以MVC为设计模式的多分布式应用程序框架外文翻译资料

 2022-12-02 19:05:16

MVC Design Pattern for the multi framework distributed applications using XML, spring and struts

Praveen Gupta,Research Scholar, Singhania University

Pacheri Bari, Rajasthan, India

praveen2gupta@gmail.com

Abstract— The model view controller (MVC) is a fundamental design pattern for the separation between user interface logic and business logic. Since applications are 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, XML

I.INTRODUCTION

Web reasingis the very complex issues these days. Since the desire of the companies and organizations are inc 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 itrsquo;s 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 internati

剩余内容已隐藏,支付完成后下载完整资料


使用XML,Spring和struts以MVC为设计模式的多分布式应用程序框架

Praveen Gupta,研究学者, 新加坡大学

Pacheri Bari,拉贾斯坦邦, 印度

praveen2gupta@gmail.com

摘要:模型-视图-控制器(MVC)是用户界面逻辑与业务逻辑之间分离的基本设计模式。 由于这些应用程序的应用规模非常大,MVC设计模式可能会使不同应用程序层之间的耦合变弱。本文介绍了基于J2EE平台中的MVC的Web应用程序框架,并将其扩展为XML,使框架更加灵活,可扩展,并且易于维护。这是一个包括了表示层,业务层,数据持久层和数据库层在内的多层系统。单独的代码,提高了应用程序的可维护性和可重用性。在本文中,我们使用spring和struts框架实现了MVC。我们的研究表明,应用多框架来使用MVC概念设计应用程序使得应用程序比单个框架更加容易。

关键字:MVC,Spring,XML

  1. 介绍

近些年来,web开发是非常复杂的问题。因为公司和组织越来越多,不同类型的通讯设备也越来越多,不同类型的通讯设备的复杂性也在不断增加,特别是当业务要求应用程序使用web以及许多通信设备的时候,网络编程的性能就变得越加的重要。所以在互联网上,随着互联网的的数据增加负荷的同时,在增加负载的数据,我们还必须要照顾到体系结构的问题。让我们简要讨论下到目前为止关于MVC中做的研究。

1.1没有MVC

在web开发的初始阶段,页面被用来在html中设计,其中html是纯文本文件。这是第一个在互联网上工作的标记语言。今天,它仍然作为所有基于互联网的编程语言的基础。用户必须实现与静态页面的交互,在页面上写的信息必须手动更改。随着时间的增长,需求出现的语言,可以与用户交互,页面可以根据用户的要求而改变。

1.2 MVC模式一

架构的第一个重大变化是由于引进了MVC模式一架构,由于引入了MVC模式,这种具有控制演示、业务逻辑和流程的架构是以页面为中心的,以Java语言为服务器的页面程序。逻辑就是在这个模型概念中介绍的。Java bean和scriptlet、表达式等业务逻辑都是以硬性编码的形式存在的。页面里的所有代码都是用jsp编写的。让我们假设,我们想传输基于我们收到数据时的jsp的情况。

图一 页面导航MVC-1框架

1.3 MVC模式二

模型一架构能够解决一些网络和互联网编程的问题,但仍然有很多东西缺失。它以jsp页面的导航为中心,所以在体系结构的角度上有进一步发展的范围。在这个过程中未来发展的是模式二的架构。模式二架构解决了一起使用Servlet和JSP的问题。能够服务处理初始请求和部分处理数据。它创建bean然后将结果转发到jsp页面中的一个。Servlet决定从当前显示的页面跳转到另一个页面。

图二 MVC-2框架

在这个模型二架构中的JSP页面仅仅用于演示目的。业务逻辑已经从页面删除。这样使得页面更容易代表,并且轻重量级页面也很容易在互联网上显示。

在这个模型二中所有的控制和应用程序逻辑都由Servlet处理。Servlet是用java编程语言编写的,因此,它也更容易处理servlet的编程部分。在这种情况下,Servest则成为了完整应用的完整功能,Servest已成为应用的中心点。

在模型二架构中,Servlet成为所有常见任务的“看门人”。它提供了非常多的公共服务,如身份验证、授权、错误控制和应用程序的循环。这种体系结构解决了大部分的问题。但仍然有许多新的问题出现在这个应用架构中。

  1. 应用架构与多个框架

网络和互联网是不断发展的领域,对应用程序的需求也正在增长。单独的一个框架是不能处理应用程序的体系结构的需求的。为了满足应用程序的潮流要求,有必要设计一个完整的框架体系结构,以实现框架。

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控制器(Servlet控制器部分);Java服务器页面或任何其他演示技术(视图部件);应用程序业务逻辑,应用程序的形式(模型)。

Spring组件

在Spring里,我们也遵循MVC的原则。它已经被设计为更多的基于互联网和桌面的应用程序。Spring由三个核心协作组件组成。

1.控制器:处理导航逻辑,并与服务层进行业务逻辑交互。

2.模型:控制器和视图之间的合同包含呈现控制器填充的视图所需的数据,控制器和视图之间的联系,包括由控制器渲染的视图和其所需的数据。

3.视图:根据用户请求,呈现对请求的响应并从模型中获取数据。

Spring MVC核心组件如下。

1.前端控制器:Spring的前端控制器实现。它是控制器进行交互的第一个请求。我们也可以说它是一个Servlet的实现。它控制应用程序的完整流程。

2.控制器:用户创建的组件来处理请求封装导航逻辑代表服务对象的业务逻辑。

3.视图:负责渲染输出。根据结果和观看设备,通信设备,可以选择不同类型的输出基础的不同视图。

4.模型和视图:模型和视图是spring框架的核心部分。它实现了应用程序的业务逻辑。它是由控制器控制。它存储业务逻辑和与之相关联的视图。每当它执行时,它将用视图的名称来处理数据,存储业务逻辑和与之相关联的视图。

5.视图处理器:如何输出显示将取决于收到的来自于模型和视图的结果。它用于实现将逻辑视图名称映射到实际视图。这部分标识时实现输出媒体是什么,以及如何显示该媒体。

6.处理器映射:该接口使用前端控制器传入的请求映射到单个控制器。它标识请求,并调用相应的处理程序提供的服务。

下面的图显示了该模型的工作原理。在这个前端控制器应用程序的入口点,Struts部分作为框架,可以正常工作,前端控制器用于发送请求。Servlet决定处理程序。然后它将调用控制器,控制器执行相应的模型与视图。

图5 序列流应用程序的spring框架

  1. 提出的方法

这种方法是基于应用程序的两个框架Struts和Spring的应用程序开发的组合。联合应用的顺序图的组合应用程序解释如上图所显示,这是应用程序的主要驱动力。要想使用这种方法,web应用程序的基本知识是必不可少的。我们已经测试了上述概念,并成功地找到它的优点,上述体系结构的主要优点如下:

1.它将在操作,操作表单,控制器,处理程序,JavaBeans模型和视图之间提供一个非常干净的区分。

2.我们使用的优势是Spring MVC非常灵活。不像Struts,这迫使你的行动和表单对象具体的继承。

3.Spring MVC是完全基于接口的。Spring MVC框架的每一部分都是可配置的。

4.它提供了控制器,可以方便地处理用户界面中的许多请求。

5.我们可以使用JSP或任何其他技术来显示视图,给用户的任何输出设备输出结果视图。

6.Spring配置控制器通过控制的反转。这使得它们容易测试并与其他由spring管理的对象进行集成。

7.Spring MVC web层与Struts web层相比,由于避免了强制实现继承和控制器对调度程序Servlet的显式依赖,所以Spring MVC相对更好一些。

8.Web层成为业务对象层的顶部的薄层,这种方法是更加提倡的。

9.Struts框架的目的仅用于设计web界面。spring框架的目的则是开发桌面以及网络应用程序。当两个框架结合,它们的灵活性则将体现出来。

  1. 总结

与任何单一框架相比,多框架体系结构能够更好的工作。通过为开发大型应用程序的多个框架的有效性,我们可以在处理请求数量,处理能力和最大限度利用机械的情况下,提高大数据库应用程序的性能。也将为公司和程序员开辟新的范围和新的商业机会。建议使用多个框架来实现更好的性能。由于大量的java代码,我无法在这里提供。

  1. 未来研究

开放的技术是吸引学术和研究学者的最好的方法。由于开放技术,现在的J2EE是一片广阔的领域。 随着技术的变化,架构也在不断的变。有许多的框架可以用于与J2EE技术一同工作,单独的某一个架构是永远不足以提供完整的解决方案的所有基本功能的应用程序。我们将努力工作,与许多其他框架一起进一步实施,以提高MVC架构。

参考文献:

[1] Shu-qiang Huang, Huan-ming Zhang,” 基于Struts和XSL的MVC改进设计模式研究” , 信息科学与工程isise 08国际研讨会,2008,vol.1 PP.451–455

[2] Juanjuan Yan; Bo Chen; Xiu-e Gao,”于Struts和Hibernate的结构集成研究”, 2009年世界大会,计算机科学与信息工程,2009,vol.7,PP.530-534

[3] Wojciechowski,J.;Sakowicz,B.;Dura,K.;Napieralski,A.,”基于J2EE平台的MVC模式、Struts框架和Web应用中的文件上传问题”,2004年无线电工程现代问题国际会议论文集,电信与计算机科学,2004,PP.342-345

[4] Erxiang Chen;Minghui Liu,”基于Struts和Hibernate框架的图书馆管理系统的研究与设计”,2009年09月信息工程国际会议 09,2009,Vol.2,PP.310-313

[5] Yonglei Tao;“组件-应用层MVC结构”,教育前沿2002第三十二年度, 2002,Vol 1,PP. T2G-7 - T2G-10

[6] Meiyu Fang,”基于Struts和EJB的Web考试系统的设计与实现”,2008年第七国际网络学习会议,2008,pp.25-28

[7] Wang Ning;Li Liming;Wang Yanzhang;Wang Yi-bing;Wang Jing,”基于MVC设计模式的Web信息系统开发平台研究”,IEEE/计划/ACM Web智能和智能代理技术国际会议,2008, Vol 3,pp. 203-206

剩余内容已隐藏,支付完成后下载完整资料


资料编号:[25593],资料为PDF文档或Word文档,PDF文档可免费转换为Word

您需要先支付 30元 才能查看全部内容!立即支付

课题毕业论文、外文翻译、任务书、文献综述、开题报告、程序设计、图纸设计等资料可联系客服协助查找。