SSH整合步骤:
1、添加spring框架
2、添加hibernate框架
3、添加struts框架
4、添加4个包分别是:
com.scme.ssh.action
com.scme.ssh.biz
com.scme.ssh.dao
com.scme.ssh.persist
5、通过Hibernate对数据库的映射,实现持久层
6、写DAO层(BaseDao)
7、写业务层(biz)
8、实现action
9、在struts.xml中配置action
10、给业务层、action层分别建一个spring配置文件
11、完成各层注入配置
在dao层中注入sessionFactory
在biz层中注入dao
在action层中注入biz
12、在web.xml中配置启动spring文件
13、在web.xml中配置struts信息
1、添加spring框架
2、添加hibernate框架
3、添加struts框架
4、添加4个包分别是:
com.scme.ssh.action
com.scme.ssh.biz
com.scme.ssh.dao
com.scme.ssh.persist
5、通过Hibernate对数据库的映射,实现持久层
6、写DAO层(BaseDao)
7、写业务层(biz)
8、实现action
9、在struts.xml中配置action
10、给业务层、action层分别建一个spring配置文件
11、完成各层注入配置
在dao层中注入sessionFactory
在biz层中注入dao
在action层中注入biz
12、在web.xml中配置启动spring文件
<context-param>
<param-name>contextConfigLocation</param-name>
<param-value>classPath*:application*.xml</param-value>
</context-param>
<listener>
<listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
</listener>
13、在web.xml中配置struts信息
<filter>
<filter-name>struts2</filter-name>
<filter-class>org.apache.struts2.dispatcher.FilterDispatcher</filter-class>
</filter>
<filter-mapping>
<filter-name>struts2</filter-name>
<url-pattern>/*</url-pattern>
</filter-mapping>