Action+service+DAO
来源:互联网 发布:sql server好学吗 编辑:程序博客网 时间:2024/06/05 18:11
参考来源:http://blog.csdn.net/inter_peng/article/details/41021727
1. Action/Service/DAO简介:
Action是管理业务(Service)调度和管理跳转的。
Service是管理具体的功能的。
Action只负责管理,而Service负责实施。
DAO只完成增删改查,虽然可以1-n,n-n,1-1关联,模糊、动态、子查询都可 以。但是无论多么复杂的查询,dao只是封装增删改查。至于增删查改如何去实现一个功能,dao是不管的。
2、 DAO与DTO的区别
DAO叫数据访问对象
DTO是数据传输对象
DAO通常是将非对象数据(如关系数据库中的数据)以对象的方式操纵。
DTO通常用于不同层(UI层、服务层或者域模型层)直接的数据传输,以隔离不同层,降低层间耦合
现在最基本的分层方式,结合了SSH架构。Model层就是对应的数据库表的实体类。Dao层是使用了hibernate连接数据库、操作数据库(增删改查)。Service层:引用对应的Dao数据库操作。Action层:引用对应的Service层,在这里结合Struts的配置文件,跳转到指定的页面,当然也能接受页面传递的请求数据,也可以做些计算处理。
以上的Hibernate, Struts,都需要注入到spring的配置文件中,Spring把这些联系起来,成为一个整体。
3、spring配置文件
4、web.xml
<servlet> <description>...</description> <servlet-name>XXServlet</servlet-name> <servlet-class>路径</servlet-class> <load-on-startup>1</load-on-startup> </servlet>
贴一段英文原汁原味的解释如下:
Servlet specification:
The load-on-startup element indicates that this servlet should be loaded (instantiated and have its init() called) on the startup of the web application. The optional contents of these element must be an integer indicating the order in which the servlet should be loaded. If the value is a negative integer, or the element is not present, the container is free to load the servlet whenever it chooses. If the value is a positive integer or 0, the container must load and initialize the servlet as the application is deployed. The container must guarantee that servlets marked with lower integers are loaded before servlets marked with higher integers. The container may choose the order of loading of servlets with the same load-on-start-up value.
翻译过来的意思大致如下:
1)load-on-startup元素标记容器是否在启动的时候就加载这个servlet(实例化并调用其init()方法)。
2)它的值必须是一个整数,表示servlet应该被载入的顺序
2)当值为0或者大于0时,表示容器在应用启动时就加载并初始化这个servlet;
3)当值小于0或者没有指定时,则表示容器在该servlet被选择时才会去加载。
4)正数的值越小,该servlet的优先级越高,应用启动时就越先加载。
5)当值相同时,容器就会自己选择顺序来加载。
所以,x,中x的取值1,2,3,4,5代表的是优先级,而非启动延迟时间。(参考其他文档)
- Action+Service +Dao Model
- Action/Service/DAO
- Action(controller) service DAO
- Action/Service/DAO简介
- Action+service+DAO
- Action/Service/DAO
- Action/Service/DAO
- dao---service---action分层结构
- Action+Service +Dao三层的功能划分
- action service dao entity form 简单理解
- Java Web中的Action、Dao、Service、Model
- springIoc案例之action/service/dao
- dao层 service层 action层
- Action/Service/DAO的应用解释
- Java Web中的Action、Dao、Service、Model
- service注入DAO组件 与 Action注入service区别
- ssh2中采用dao---service---action分层结构
- Spring的bean、dao、service、action的生命周期
- 面试题---静态代码块和构造函数的执行顺序
- 深度学习与计算机视觉系列(6)_神经网络结构与神经元激励函数
- windows下maven环境开发hadoop mapreduce程序报Cannot initialize Cluster
- Linux一键修改主机名
- ViewStub用法
- Action+service+DAO
- OSI七层网络模型
- Struts2教程____Struts2简介
- jquery合并单元格
- url传递参数时遇到的乱码问题解决方法
- NDK入门:Android.mk实用技巧
- LeetCode 25. Reverse Nodes in k-Group
- make 、make clean、make depend的区别
- 日记一