MVC framework

MVC is a pattern for creating web applications using MVC (Model View Controller) design:  
  • Model (model) represents the core of the application (such as a list of database records).
  • View displays data (database records).
  • The Controller processes the input (writes database records).
The MVC pattern simultaneously provides full control over HTML, CSS, and JavaScript.
A Model is the part of an application that handles the logic of the application's data.
  Usually model objects are responsible for accessing data in the database.
The View is the part of the application that handles the display of data.
  Usually views are created from model data.
The Controller is the part of the application that handles user interaction.
  Usually the controller is responsible for reading data from the view, controlling user input, and sending data to the model.
MVC layering helps manage complex applications because you can focus on one aspect at a time. For example, you can focus on view design without relying on business logic. It also makes testing the application easier.
MVC layering also simplifies group development. Different developers can develop views, controller logic, and business logic at the same time.

view

A view is the interface that the user sees and interacts with. For old-fashioned web applications, the view is the interface composed of HTML elements. In modern web applications, HTML still plays an important role in the view, but some new technologies have emerged one after another, including Adobe Flash and Some markup languages ​​and Web services like XHTML , XML / XSL , WML , etc.
The benefit of MVC is that it can handle many different views . No real processing happens in the view, whether the data is stored online or a list of employees, as a view, it's just a way to output data and allow the user to manipulate it  

Model

Models represent enterprise data and business rules. Of the three components of MVC, the model has the most processing tasks. For example, it might use component objects like EJBs and ColdFusion Components to handle databases. The data returned by the model is neutral, that is, the model is independent of the data format. Such a model can provide data for multiple views. The code that is written only once can be reused by multiple views, so code duplication is reduced.  

controller

The controller accepts the user's input and invokes the models and views to fulfill the user's needs, so when the hyperlink in the web page is clicked and the HTML form is sent , the controller itself does not output anything and do any processing. It just receives the request and decides which model component to call to handle the request, and then decides which view to use to display the returned data  

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=324741958&siteId=291194637