MVC
核心 思想:利用Servlet(C)使视图(V)和模型(M)联系起来。
三层架构
1.表示层(USL user show layer):
--前台 a.作用:对应于MVC的V,用于用户交互,界面显示;
b.常用技术:html,css,js,jsp;
c.位置:位于WebContent文件夹中。
--后台
a.作用:对应于MVC的C,用于控制跳转,调用业务逻辑层;
b.常用技术:Servlet(SpringMVC,Struts);
c.位置:位于xxx.servlet包中。
2.业务逻辑层(BLL business logical layer):
3.数据访问层(DAL data access layer):
三层优化
1.加入接口——面向接口开发,先接口再实现类
(1)service和dao加入接口;
(2)接口与实现类的命名规范(实体类以Student为例):
接口:interface 命名:IStudentService
IStudentDao
实现类:implement 命名:StudentServiceImpl
StudentDaoImpl
2.DBUtil数据库帮助类——简化Dao层代码量
帮助类一般建议写在xxx.util包