1.创建web工程,添加struts支持。
2.分包。
com.demo.ssh
com.demo.ssh.action
com.demo.ssh.dao
com.demo.ssh.entity
com.demo.ssh.form
com.demo.ssh.service
3.添加Spring支持。
4.添加Spring配置文件。
5.在web.xml中配置初始化读取参数(Spring配置文件)
6.配置Spring监听器。
7.在struts-config.xml中配置请求处理器,将struts请求委托给Spring处理,达到控制反转之目的。
8.添加hibernate支持。
9.配置好hibernate之后,在apllicationContext.xml中会自动生成数据源。
10.通过表,反向生成“实体类”,“配置文件。”
11.当中正确添加实体后,在applicationContext.xml中自动生成实体类的映射。
12.修改DAO类的位置,修改配置文件属性值。
13.添加service类,反转service Class
14.添加struts部分(jsp,form,action)
15.将struts-config.xml文件中action节点的type属性去掉
16.在applicationContext.xml文件中代理action类,也是一种控制反转实现
17.调试
注意: