SSH 整合方式总结


---SSH 整合 方式one---

1.添加Spring 支持
    Core         Libraries
    AOP          Libraries
    Web      Libraries
    J2EE         Libraries

2.添加Hibernate 支持
    one--添加Hibernate 注意
        第二步:
            选择:Spring configuration file(applicationContext.xml)
        第三步:
            选择:Existing Spring configuration file
            sessionFactory ID(输入): sessionFactory
        第四步:
            Bean Id: (input) dataSource
            DB Driver: (根据需要选择)
            Dialect: (根据需要选择)
        第四步:
            Create SeeionFactory class?(不需要选择)
    two---添加添加实体及映射文件时注意
    在使用HiberNate 添加实体及映射文件时,注意:
        选中:(共三项)
            1.Hibernate mapping file(x.hbm.xml)for each database table
                a.Update hibernate configuration with mapping file location
            2.Java Data Object (POJO<>DB Table)
    three----add package
        创建Dao,biz package
        在Spring 中配置注入Dao类的 sessionFactory 参数
   
3.添加Struts 支持
   
    one---- 添加Struts 支持
   
    two---- 添加 struts-config.xml config info
       
        在struts中配置Action 且交给Spring 管理
        1.添加plug-in 配置插件(两种情况)
       
        <plug-in className="org.springframework.web.struts.ContextLoaderPlugIn">
            <set-property property="contextConfigLocation"value="/WEB-INF/applicationContext.xml" />
        </plug-in>
       
        <plug-in className="org.springframework.web.struts.ContextLoaderPlugIn">
            <set-property property="contextConfigLocation"value="classpath:applicationContext.xml" />
        </plug-in>
   
        2.配置struts-config.xml 中的Action
        <action
            parameter="type" path="/student"
            type="org.springframework.web.struts.DelegatingActionProxy"
            scope="request" validate="false">
            <forward name="list" path="/list.jsp" />
        </action>
       
        3.在applicationContext.xml 中配置Action
           
        <bean name="/student" class="com.taink.struts.action.StudentAction">
            <property name="studentBiz" ref="studentBiz"/>
        </bean>
       
       
       
   
---SSH 整合 方式two(最后整合Struts 时有所不同)---

1.添加Spring 支持
    Core         Libraries
    AOP          Libraries
    Web          Libraries
    J2EE         Libraries
    Remoting     Libraries
    Misc         Libraries

2.添加Hibernate 支持
    one--添加Hibernate 注意
        第二步:
            选择:Spring configuration file(applicationContext.xml)
        第三步:
            选择:Existing Spring configuration file
            sessionFactory ID(输入): sessionFactory
        第四步:
            Bean Id: (input) dataSource
            DB Driver: (根据需要选择)
            Dialect: (根据需要选择)
        第四步:
            Create SeeionFactory class?(不需要选择)
    two---添加添加实体及映射文件时注意
    在使用HiberNate 添加实体及映射文件时,注意:
        选中:(共三项)
            1.Hibernate mapping file(x.hbm.xml)for each database table
                a.Update hibernate configuration with mapping file location
            2.Java Data Object (POJO<>DB Table)
    three----add package
        创建Dao,biz package
        在Spring 中配置注入Dao类的 sessionFactory 参数
   
3.添加Struts 支持
   
    one---- 添加Struts 支持
   
    two---- 添加 struts-config.xml
       
        1.在web.xml 中配置spring
            <!-- spring config -->
            <listener>
                <listener-class>
                    org.springframework.web.context.ContextLoaderListener
                </listener-class>
            </listener>
            <context-param>
                <param-name>contextConfigLocation</param-name>
                <param-value>/WEB-INF/applicationContext.xml</param-value>
            </context-param>
           
        2.在struts-config.xml中配置
           
            <controller>
                <set-property property="processorClass"
                    value="org.springframework.web.struts.DelegatingRequestProcessor" />
            </controller>
        3.在applicationContext.xml 中配置Action
           
        <bean name="/user" class="org.taink.struts.action.UserAction">
            <property name="userBiz" ref="userBiz"></property>
        </bean>

 

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值