Model - View - Controller (MVC) is a software design pattern that appears in the 80s SmallTalk-80, which has now been widely used.
1, the model (model) model is the main part of the application. The model represents business data, or business logic. 2, the view (view) view is part of the user interface in the application, which is the interface that the user can interact and interact with it. 3. Controller controller work is based on the user's input, control the user interface data display and update the Model object state. The appearance of the MVC not only implements the separation of the functional module and the display module, but it also improves the user's maintainability, scalability, portability, and components's ability to reuse early, if not paying attention to Decoupling of digital function and display often leads to complex and difficult to maintain procedures. A lot of VB, Delphi and other RAD programs have this problem. Even now C #, Java sometimes also appears to write business logic in the display module MVC design mode very early, but introducing MVC in the development of a web project is difficult. Main reason: First, in the development of early Web projects, the separation of programming language and HTML has been difficult to implement. The CGI program generates HTML content as a string output. Later, as the scripting language appeared, the previous way was fell over, and it was changed to embedded the script language to the HTML content. These two ways have an identical shortcomings, that is, they can always separate program languages and HTML. Second, the function of the scripting language is relatively weak, lacks some necessary technical foundations for supporting MVC design patterns. It is only changed until J2EE-based JSP Model 2 has been introduced. It uses JSP technology to implement view features, with servlet technology to implement the function of the controller, using JavaBean technology to implement models. JSP Model 1 and JSP Model 2 Sun have an early JSP to develop two specifications, called Model1 and Model2. Although Model2 implements MVC to a certain extent, its application is not satisfactory JSP Model 1 JSP Model 2 Model2 easy to make the system multiple controller, and more complicated to page navigation is more complicated. Some people think that Model2 is still not good enough. So Craig R. McClanahan has submitted a web framework to Java Community in May 2000. This is the subsequent Struts. In July 2001, Struts1.0, officially released. The project has also become one of the Struts of Apache Jakarta's subproject is an MVC architecture implemented on the basis of Model2. It has only one central controller, and he uses XML customized URL. Use action to handle logic