1.导入jar包
2.加入Hibernate的支持。
3.加入spring的支持。
4.构建系统的包
5.生成Hibernate的映射文件。
6.编写DAO层(面向接口编程)
(1)dao层实现类继承HibernateDaoSupport
(2)在Spring主配置文件里注入sessionFactory
7.编写BIZ层(面向接口编程)
(1)在Spring主配置文件里注入dao
8.加入struts支持
(1)开启动态方法调用。
9.编写action继承ActionSupport类在spring环境中注入biz
10.编写web.xml文件
`配置web.xml
<context-param>
<description>Spring主配置文件</description>
<param-name>contextConfigLoacation</param-name>
<param-value>classpath:applicationContext.xml</param-value>
</context-param>
配置Spring监听器(加载Spring)
<listener>
<listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
</listener>
配置opensession
<filter>
<filter-name>opensession</filter-name>
<filter-class>org.springframework.orm.hibernate3.support.OpenSessionInViewFilter</filter-class>
</filter>
<filter-mapping>
<filter-name>opensession</filter-name>
<url-pattern>/*</url-pattern>
</filter-mapping>
11 配置Struts.xml
<action name="emp" class="empaction">
<result name="success">/success.jsp</result>
</action>`
class属性值是Spring配置文件里面一个bean的名字