您的位置:首页 > 其它

SSH整合步骤,三大框架的整合步骤

2014-05-30 14:40 302 查看
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文件

<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>
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: