当前位置:网站首页>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 .
边栏推荐
- js中==和===区别
- 1:开启慢查询日志 与 找到慢SQL
- 进程线程协程的区别
- 基于php心理健康服务系统获取(php毕业设计)
- At the moment of the epidemic, online and offline travelers are trapped. Can the digital collection be released?
- (php毕业设计)基于php小说网站管理系统获取
- Use Python to encapsulate a tool class that sends mail regularly
- 发售预告:7月22日“大暑”发售,【传统国风廿四节气】夏季发售完毕。
- 50 MySQL exercises + Answers
- 变量,流程控制与游标
猜你喜欢

CMD and NPM basic commands

(php毕业设计)基于thinkphp5校园新闻发布管理系统获取

Tornado初识

基于php学生学籍管理系统获取(php毕业设计)

幂等性组件

记录下在线扩容服务器遇到的问题 NOCHANGE: partition 1 is size 419428319. it cannot be grown

Mars number * word * Tibet * product * Pingtai defender plan details announced

基于php小区疫情出入管理系统(php毕业设计)

DOM模型的相关概念和操作

手撸一个简单的RPC(<-_<-)
随机推荐
数字藏品成文旅产业新热点
DataX安装及使用
排序与分页,多表查询课后练习
JS = = and = = = differences
ModuleNotFoundError: No module named ‘pip‘
Books - mental models
【五】redis主从同步与Redis Sentinel(哨兵)
NSCTF-web题目writeup
2:为什么要读写分离
Community epidemic access management system based on PHP (PHP graduation design)
南京邮电大学CTF题目writeup (一) 含题目地址
ES6 --- deconstruction assignment
数字藏品的生意没那么好做
JS simple publish and subscribe class
At the moment of the epidemic, online and offline travelers are trapped. Can the digital collection be released?
撞脸ins? Mars数字藏品平台探索数字藏品轻社交
区分实时数据、离线数据、流式数据以及批量数据的区别
No module named yum
命令注入绕过方式总结
Spark中的Structured Streaming