JavaWeb (four): MVC Case

MVC is the Model-View-Controller short, i.e., Model - View - Controller.
MVC is a design pattern, which the application is divided into three core modules: model, view, controller, each handle its own tasks. Model is the main part of the application, the model of the business data and business logic. A model can provide data for a plurality of views. Since the code is applied to the model only write once to be reused multiple views, so increase the reusability of code. View of the user to see and interact with the interface, the role of the following: view displays data to the user, accept user input, without any actual business process. The controller accepts user input and calls the model and view to the completion of the needs of users. The controller receives the request and determines which model component invokes to process the request, and then decide which view to display the call processing data model returned.

The part of the logical part, access to the database on the Servlet, JSP page on the display section.
Retransmission request to the server, the server calls the Servlet, Servlet make a controller, according to the situation to take away Java class is called the request, Java classes, and complete the operation business logic to access the database, according to the result returned POJO steering JSP, JSP display, display when you can use some of the standard tag library.
POJO contains processing logic, business logic, and to access the database.
JSP Servlet move to a different page depending on the results returned, turned the way include redirection and forwarding.

model:

controller:Servlet

view:JSP

 

A query

 

 

Second, delete

 

 

Third, architecture analysis

 

 

Four, DAO layer

 

 

Five, corresponding to a plurality of requests Servlet

 

 

Sixth, fuzzy query

 

 

Seven, delete

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

Guess you like

Origin www.cnblogs.com/aidata/p/11986345.html