-----------------------------the MVC section-----------------------------------------
1. The full name of MVC is Model Viewcontroller, which is the abbreviation of models-View-Controller (Controller), an example of software design, which organizes code by means of a business logic, data and interface display. Clustering business logic into a single component, without having to rewrite the business logic while improving and customizing the interface and user interaction.
Model is the part of an application that handles the logic of application data.
Typically, the model object is responsible for accessing data in the database.
View is the part of your application that handles the display of data.
Usually the view is created from the model data.
The Controller (Controller) is the part of the application that handles user interaction.
The controller is usually responsible for reading data from the view, controlling user input, and sending data to the model.
----------------------------------Struts2 Part------------------------------------
1. Struts 2 is a web framework based on MVC, a new MVC framework developed on the basis of webwork technology.
2. Work Flow
The 1> client browser makes an HTTP request.
2> According to Web.xml configuration, the request is Filterdispatcher received
3> based on the Struts.xml configuration, find the action class and method that needs to be invoked, and inject the value into the Aciton via the IOC method.
The 4> action invokes the business logic component to handle the business logic, which includes form validation.
5>action execution completed, according to the configuration in Struts.xml find the corresponding return results result, and jump to the appropriate page
6> return HTTP response to client browser
3. Working principle
1> client Initializes a request to the servlet container
2> this request passes through a series of filters (filter)
3> then Filterdispatcher is called and Filterdispatcher asks Actionmapper to decide whether or not you need to call an action
4> if Actionmapper decides to call a action,filterdispatcher to give actionproxy the processing of the request
5 > Actionproxy to find the action class that needs to be invoked by asking the framework's configuration file ConfigurationManager
6> Actionproxy creates an instance of Actioninvocation.
The 7>actioninvocation instance is invoked using a naming pattern, which involves calls to the associated interceptor (Intercepter) before and after the action is invoked.
8> once the action is completed, Actioninvocation is responsible for finding the corresponding return result according to the configuration in Struts.xml.
4. Why use STRUTS2.
1> Open-source MVC framework
2> Pure Pojo Action
3> Better Tag Features
4> Easy Test
5> Easy to expand
-----------------------------------Hibernate part--------------------------------
1. Hibernate is an open source Object Relational mapping framework that has a very lightweight object encapsulation for JDBC, allowing Java programmers to manipulate the database with arbitrary object-programming thinking.
2. Working principle
1> through configuration (). Configure (); Reading and parsing hibernate.cfg.xml configuration file
2> the mapping information by reading and parsing in Hibernate.cfg.xml
3> through Config.buildsessionfactory ();//Create Sessionfactory
4> sessionfactory.opensession ();//Open Sesssion
5> session.begintransaction ();//Create Transaction Transation
6> Persistent operate persistence operation
7> session.gettransaction (). Commit ()//COMMIT TRANSACTION
8> Close Session
9> off Sesstionfactory
3. Why use Hibernate.
Hibernate the JDBC access to the database code is encapsulated, greatly simplifies the data access layer cumbersome repetitive code
Hibernate is a mainstream persistence framework based on JDBC, with excellent ORM implementation, which simplifies DAO layer coding to a large extent
---------------------------------the Spring section-------------------------------------
1. Spring is a container framework for lightweight control inversion (IOC) and aspect-oriented (AOP).
2. Control reversal--spring facilitates loose coupling through a technology called Control reversal (IOC). When the IOC is applied, other objects that an object relies on are passed in passively, rather than the object itself creating or locating dependent objects.
3. Aspect-oriented--spring provides rich support for aspect-oriented programming, allowing for the development of cohesion through the separation of application business logic and system-level services and transactions.
4. Why spring is used.
1> facilitates decoupling and simplifies development
2> Convenient program test
3> convenient integration of various excellent frameworks