SSH集成的环境搭建(xml)

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的名字

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值