The application of struts in financial system based on MVC

Source: Internet
Author: User
Tags config http request

Many of the problems encountered in software development work may have been in the previous development of similar software in the process has also been resolved, the solution to the problem of the use of good methods, technology accumulated and constantly summed up to form a fixed solution, a model, In order to solve similar problems in the future system development process. Design pattern is a summary of previous development experience, it's proposed so that developers can be simple and convenient reuse of successful design programs, without having to do repetitive work every time.

The financial system has the complexity of the business logic involved, the need for flexibility, and even the individual business may be in the process of changing the characteristics of the system, so how to organize applications to make it easy to maintain and upgrade is the first issue for developers. Earlier application development was done in a procedural language, they mix data-tier code such as database query statements with presentation-layer code such as HTML, so that both changes to the business logic and changes to the interface display involve the whole of the application, making it difficult to maintain the program.

Web-Layer Solution--MVC mode

The proposed MVC pattern solves the above problem completely. MVC is the abbreviation for model (models)--view (--controller), which is suitable for the development of large, scalable Web applications, which forcibly separates the input, processing, and output of the application into three core parts of the model, view, and controller. They perform different tasks, and any part of the modification does not affect the other two parts.

In the MVC pattern, the model encapsulates the core data, logical relation and business rules of the application problem, and provides the process of business logic. The model is called by the controller to complete the process of problem-handling, on the other hand, to obtain display data for the view provides the operation of accessing the data. Because models are not data-format-independent, a model can provide data for multiple views, so that a model can be reused by multiple views at a time, thus avoiding duplication of code.

A view is an interface that users see and interact with in the MVC pattern. The view obtains data from the model, and the view's update is controlled by the controller. The view does not contain the processing of any business logic, it is just a way of outputting data.

In the MVC pattern, the controller mainly plays the role of navigation, it calls the corresponding model and view according to the user's input to complete the user's request. The controller itself does not output anything, it accepts the user's request and decides which model artifacts to call and which view to display the data returned after the model is processed.

The process of MVC is this: For each user input request, first by the controller to receive, and decide which model to process, and then the model through business processing logic processing the user's request and return data, the last controller with the corresponding view format model returned data, and through the display page presented to the user. Figure 1 shows the respective functions of the model, view, controller, and the interrelationships between the three modules:

Figure 1

Struts is the framework for implementing the MVC pattern

Design pattern is the summary of software development experience, it is a concept, is a logical entity, and the framework can be regarded as a specific platform based on one or several design patterns of physical implementation. Design patterns are more abstract than frames, the design pattern can only be represented as code, and the framework itself is represented by code, and the framework is a design-specific class with different functions and links between classes and classes, creating a reusable, scalable solution to a particular type of problem.

Struts is a common framework for implementing the MVC pattern, consisting of four major components, models, views, controllers, and XML files. The model is typically implemented by a Java bean or EJB component, which handles business logic; The view includes a set of JSP files, which are mainly made up of JSP tags or custom tags, which simplifies the coding of JSP pages; in the Struts framework, the controller mainly includes the action The Servlet class and action class, the action servlet, which is the core part of struts, accepts the user's HTTP request, forwards the request to the appropriate action object based on the configuration information, and the action class is responsible for invoking the model's methods and helping to control the application's flow; Struts includes the Web.xml and Struts-config.xml two profiles, where Web.xml is a publishing profile for Web applications, and Struts-config.xml is a description of the special information configuration associated with Struts.

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.