Research on Web application framework based on MVC design pattern

Source: Internet
Author: User
Tags object model

MVC design pattern is the preferred mode of Web application development based on Java EE, and many popular frameworks are based on MVC design pattern at present. This paper briefly introduces the MVC design pattern and struts framework, and puts forward a new Web application development framework based on MVC pattern, and--webframework the composition and function of each level of the framework.

keywords MVC design pattern; Java ee; frame; Struts

Introduction

With the rise of open source software, a variety of frameworks have emerged, such as the Apache open source framework struts is a typical representative. The application of these frameworks in the actual software development greatly reduces the complexity and difficulty of the development of Java EE, and reduces the development cost. But these frameworks also have deficiencies, such as difficult to grasp, complex configuration and so on. The purpose of this paper is to design a simple and easy web development framework--webframework,webframework structure, easy to understand, increase the scalability of the system, maintainability, reduce development costs.

MVC design Pattern

Most of the Web application system based on Java EE uses MVC pattern to realize its architecture. MVC (Model-view-controller) is a software design pattern invented in the 80 's for programming language Smalltalk-80. The MVC pattern divides the interactive application into the model, view, and Controller (Controller) three sections [1]. The model is the object model which is mined from the real world and is the reflection of the application logic. The model encapsulates the data and operation of the data, and is where the actual data processing is calculated. A view is an interface between the application and the user, which is responsible for showing the application to the user and displaying the state of the model. The controller is responsible for the interaction between the view and the model, control the response mode and process of the user input, it is mainly responsible for two aspects of the action: the user's request distributed to the corresponding model, the changes in the model in a timely manner to the view. MVC separates these objects to improve flexibility and reusability. The structure of the MVC pattern is shown in Figure 1:

Figure 1 Structure of the MVC design pattern

Struts Framework

Struts is an open source project of the Apache Foundation Jakarta Project, which uses the Servlet2.2 and JSP1.1 tags as part of an implementation that consists of a set of collaborative classes, servlet, and JSP tags that make up a reusable system design. It is a good way to help Java developers develop Web applications using EE. It has the ability to "separate the display logic from the business logic" in the design pattern. Therefore, more and more large-scale Web application projects are developed using Struts framework, or using struts architecture design, based on MVC pattern of application system development.

Struts works as shown in Figure 2:

Fig. 2 How Struts works

The advantages of struts are embodied in two aspects: Form validation and page navigation. Form validation solves the problem of validating the request data and enhances the robustness of the system. The page navigation makes the system's business process clear, the relationship between the parts of the system can be reflected through the configuration file, thus simplifying the maintenance work of the system to some extent.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.