A brief introduction of MVC
To sum up, the advantages of MVC are mainly as follows:
1 multiple views can correspond to a model. According to MVC design pattern, a model corresponding to multiple views, can reduce code duplication and code maintenance, once the model changes, it is easy to maintain
2 The data returned by the model is separated from the display logic. Model data can be applied to any display technology, such as using JSP pages, velocity templates, or directly producing Excel documents
3 application is divided into three layers, reducing the coupling between the layers, providing the scalability of the application
4 The concept of the control layer is also very effective, because it combines different models and different views to complete different requests. Therefore, the control layer can be said to contain the concept of user request permission
5 MVC is more in line with the spirit of software engineering management. Different layers, each layer of components have the same characteristics, is conducive to the adoption of engineering and tooling to generate management program code
The concept of MVC is also nonsense to this, the key is the implementation of each module is what the technology respectively.
Ii. introduction of Struts2
STRUTS2 is an MVC framework compatible with STRUTS1 and webwork.
STRUTS2 's simple processing process is as follows:
1) Browser Send request
2 The Center processor finds the corresponding action class for the processing request according to the Struts.xml file
3 WebWork's interceptor chain automatically applies common functions to requests, such as: WorkFlow, validation and other functions
4 If the method parameter is configured in the Struts.xml file, then the methods in the action class corresponding to the way parameter are invoked, otherwise the generic Execute method is invoked to handle the user request
5 respond to the browser the result returned by the corresponding method in the Action class
Three, Struts2 and Struts1 contrast
................................