当前位置:网站首页>MVC三层架构
MVC三层架构
2022-06-23 03:53:00 【不想当个程序员】
什么时MVC:Model View Controller
Servlet和JSP都可以写Java代码;未来易于维护和使用;
- Servlet专注于处理请求,以及控制视图跳转
- JSP专注于显示数据
| Controller–控制器 | View视图层 | Model |
|---|---|---|
| Servlet | JSP | JavaBean |
| 接收用户得请求 | 展示数据模型 | pojo、entity |
| 交给业务层去做 | 提供用户操作 | |
| 视图跳转 |

用户直接访问控制层,控制层就可以直接操作数据库
servlet--CRUD-->数据库
弊端:程序十分臃肿,不利于维护 servlet的代码中:处理请求、响应、视图跳转、处理JDBC、处理逻辑代码
架构:没有什么是加一层解决不了的

Model
- 业务处理:业务逻辑(Service)
- 数据持久层:CRUD(Dao)
View
- 展示数据
- 提供链接发起Servlet请求(a, form, img…)
Controller(Servlet)
- 接收用户的请求:(req:请求参数、Session信息)
- 交给业务层处理对应的代码
- 控制视图的跳转
登录---接收用户的登录请求--->处理用户的请求(获取用户登录的参数,username,password)--->交给业务层处理登录业务(判
断用户名密码是否正确:事务)--->Dao层查询用户名和密码是否正确-->数据库
边栏推荐
- GNSS速度解算的三种方法
- 如何更好地组织最小 WEB API 代码结构
- Do280openshift command and troubleshooting -- common troubleshooting and chapter experiments
- Li Kou today's question 513 Find the value in the lower left corner of the tree
- How to use data to tell a wonderful story?
- prometheus、influxdb2.2安装及flume_export下载编译使用
- Icer Skill 02makefile script Running VCS Simulation
- Magnetoresistive saturation
- Using editor How to handle MD uploading pictures?
- Install and run mongodb under win10
猜你喜欢

《微信小程序-基础篇》带你了解小程序的路由系统(二)

Talk about the composite pattern in C #
![[paper reading] semi supervised learning with ladder networks](/img/c9/e2f4b221d762f41ba6b75926293673.png)
[paper reading] semi supervised learning with ladder networks

Learn to draw Er graph in an article

【图论】—— 二分图

teqc进行GNSS数据质量分析时生成的s文件介绍

dolphinscheduler海豚调度升级代码改造-UpgradeDolphinScheduler

Flask Foundation: environment setup + configuration + mapping between URL and attempt + redirection + database connection

ICer技能02makefile脚本自跑vcs仿真

ICER skills 03design compile
随机推荐
985测试工程师被吊打,学历和经验到底谁更重要?
Project summary 1 (header file, switch, &, bit variables)
Do280openshift command and troubleshooting -- common troubleshooting and chapter experiments
Arduino温湿度传感器DHT11(含代码)
Thinkphp6 solving jump problems
Thinkphp6 linked table query without associated ID (2 tables) is mainly the application of select
PCB placing components at any angle and distance
Current relay hdl-a/1-110vdc-1
rtklib2.4.3 b34的一个与编译器有关的bug
Notepad++ find replace group replace retain
Abnova PSMA bead solution
VGg Chinese herbal medicine identification
ZK has a node reporting it is possible not running and the log has no obvious error
Abnova fluorescent dye 510-m streptavidin scheme
工作5-8年的外包测试员,平均年薪有多少?
Openwrt directory structure
实战| 记一次借Viper来多重内网渗透
Welcome to the CSDN markdown editor
With the arrival of intelligent voice era, who is defining AI in the new era?
开发一年不到,来面试居然敢开口要20K,面完连8K都不想给~