table of Contents
Two- and three-tier architecture (MVC upgrade version)
A MVC pattern
1.1 History of JSP
In the early days, there were only servlets, which could only use response to output html tags, which was very troublesome.
Later, there was JSP, which simplified the development of servlet; if JSP is used excessively, a lot of java code and html tags are written in JSP pages
, which makes it difficult to maintain and difficult to divide and collaborate.
Later, in order to make up for the problem of excessive use of jsp, we used a combination of servlet+jsp, which is conducive to division of labor and cooperation.
1.2 Introduction to MVC
MVC design pattern: Shorthand for Model-View-Controller.
MVC is a software architecture model in software engineering. It is a design method that separates business logic and display interface.
Simply put: a set of design experience summarized by the predecessors, suitable for various software development fields, purpose: high cohesion, low coupling
Two- and three-tier architecture (MVC upgrade version)
The architecture after the transformation of MVC is called the three-tier architecture
2.1 Concept
The three-tier architecture in the usual sense divides the entire business application into: the presentation (present) layer, the business logic layer, and the data access layer.
The purpose of distinguishing levels is the idea of high cohesion and low coupling
Presentation (current) layer: also known as the web layer, data interaction with the browser (controller and view)
business logic layer: also known as the service layer, processing business data (if judgment, for loop)
data access (persistence) layer : Also known as the dao (database access object) layer, which interacts with the database (each (row) record
corresponds to the javaBean entity )
Package directory structure