当前位置:网站首页>Briefly understand MVC and three-tier architecture
Briefly understand MVC and three-tier architecture
2022-07-28 06:01:00 【Programmer awei】
MVC
Speaking of mvc We are going to talk about java web Development history of :
First , At the start of the java Is used in the servlet Terminal , and servlet It is a logic program running on the server , however web Applications definitely need pages , So at this time java web Formed servlet > java + HTML +CSS + javascipt.
But later I found that it would be very inconvenient to write like this , If you modify the code, you need to restart the server frequently .
therefore , There are new technologies JSP.
JSP take HTML+CSS These front-end codes are separated , Therefore, there is no need to restart the server after modifying the page , Just refresh the browser , At the same time, it supports jsp Write in the page java Code , Because it is so convenient , As a result, there is no need to use it later servlet, Direct logic ,jdbc Both ends are written in jsp page .
But it was later found that this was not possible , Because a lot of java、HTML、CSS,JS Code coupled together , It's very troublesome to strip part of the code later .
until MVC The emergence of patterns , It compulsorily divides our code into :model + view +controller
controller( Control layer )
Control the flow of our data , stay web In the application, it can be said that it is the interface end
View( View layer )
Provide user view interface , That is, to be responsible for HTML + CSS
Model( The model layer )
The models here fall into two categories : Data model and UI Model
Data model is entity class
UI Model is logic
Three layer architecture
Many people will MVC Think it's a three-tier architecture , It's not .
The three-tier architecture model is a pure java Architecture mode of , There is no such thing as page view .
Three layer architecture :controller + service + dao
controller( Control layer )
Control the flow of data , For example, print data from the console or store data in another place , Therefore, it plays a scheduling role .
service( Service layer )
Responsible for the logic of the code .
dao( Persistence layer )
Dealing with data , Scale database , file .
边栏推荐
- Set scroll bar
- (php毕业设计)基于thinkphp5小区物业管理系统
- Tornado初识
- (PHP graduation project) obtained based on PHP student homework submission management system
- 文旅头部结合数字藏品效应显著,但如何支撑用户持续购买力
- tcp和udp的区别和联系
- The combination of cultural tourism and digital collections has a significant effect, but how to support users' continuous purchasing power
- At the moment of the epidemic, online and offline travelers are trapped. Can the digital collection be released?
- Use Python to encapsulate a tool class that sends mail regularly
- How digital library realizes Web3.0 social networking
猜你喜欢
随机推荐
2:为什么要读写分离
Community epidemic access management system based on PHP (PHP graduation design)
文旅头部结合数字藏品效应显著,但如何支撑用户持续购买力
Flume安装及使用
xml解析实体工具类
Hit your face ins? Mars digital collection platform explores digital collection light social networking
(php毕业设计)基于php学生日常行为管理系统获取
Screenshot transferred to the background
MYSQL的select语句查询;运算符课后练习
Flume installation and use
单行函数,聚合函数课后练习
Chapter 8 aggregate function
南京邮电大学CTF题目writeup (一) 含题目地址
(php毕业设计)基于php小说网站管理系统获取
[interview question] anti shake and throttling
NSCTF-web题目writeup
JS simple publish and subscribe class
Mars number * word * Tibet * product * Pingtai defender plan details announced
(php毕业设计)基于php校园网络报修管理系统获取
MySQL练习题50道+答案



![Notice of attack: [bean Bingbing] send, sell, cash, draw, prize, etc](/img/53/d6db223712c4fe0cdcab313ec5dea8.jpg)




