当前位置:网站首页>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层查询用户名和密码是否正确-->数据库
边栏推荐
- Mini Homer - can you get a remote map data transmission link for hundreds of yuan?
- Three operation directions of integral mall
- 开发一年不到,来面试居然敢开口要20K,面完连8K都不想给~
- A mvc5+easyui enterprise rapid development framework source code BS framework source code
- dolphinscheduler 2.0.5 任务测试(spark task)报错:Container exited with a non-zero exit code 1
- UI自动化定位利器-xpath实战
- Flask基础:环境搭建+配置+URL与试图之间的映射+重定向+数据库连接
- Thinkphp6 solving jump problems
- Composer by installation laravel
- 微信小程序:全新趣味测试
猜你喜欢

【OFDM通信】基于matlab OFDM多用户资源分配仿真【含Matlab源码 1902期】

ApiPost接口测试的用法之------Post

强推,软件测试快速入门,一看就会

Less than a year after development, I dared to ask for 20k in the interview, but I didn't even want to give 8K after the interview~

dolphinscheduler 2.0.5 任务测试(spark task)报错:Container exited with a non-zero exit code 1

Metadata management Apache Atlas Compilation (embedded) deployment and various error records encountered
![[graph theory] - bipartite graph](/img/2d/999820edafe7294440cf1873a26084.png)
[graph theory] - bipartite graph

工作5-8年的外包测试员,平均年薪有多少?

Dolphin scheduler 2.0.5 spark task test summary (source code optimization)

DO280OpenShift命令及故障排查--常见故障排除和章节实验
随机推荐
Official download and installation of QT and QT vs tools plug-ins
ICer技能01正则匹配
Reinstallation of cadence16.3, failure and success
七年码农路
Receive incoming files and download (simple usage) a tag
美团好文:从预编译的角度理解Swift与Objective-C及混编机制
Cve-2019-14287 (sudo right raising)
Can bus Basics
Cloud function realizes fuzzy search function
微信小程序:爱情保证书制作生成
[graph theory] - bipartite graph
硬核,成为高素质测试人员:学会和产品沟通需求
dolphinscheduler 2.0.5 任务测试(spark task)报错:Container exited with a non-zero exit code 1
聊聊 C# 中的 Composite 模式
centos7部署docker,安装mysql
Precautions for running high-frequency and high-speed signal lines near PCB board - basic principles for high-frequency and high-speed signal design
"Wechat applet - Basics" takes you to understand the routing system of the applet (2)
The solution to prompt "this list creation could be rewritten as a list literal" when adding elements to the list using the append() method in pychart
Go learning record II (window)
Project summary 1 (header file, switch, &, bit variables)