struts_spring_hibernate

ssh整合步骤:
 1:引入struts能力:
 2:引入spring能力:
  spring 3.0 core libraries
  spring 3.0 persistence core libraries
  spring 3.0 aop libraries
  spring 3.0 persistence jdbc libraries
  spring 3.0 web libraries
 3:引入hibernate能力:
  hibernate 3.3 core lib
  hibernate 3.3 annotations
 4:进行spring初始化过程:
  方案一:
  web.xml中加入
   <listener>
           <listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
       </listener>
   <context-param>
    <param-name>contextConfigLocation</param-name>
    <param-value>/WEB-INF/classes/applicationContext.xml</param-value>
   </context-param>
  方案二:
  struts-config.xml中加入
   <plug-in calssName="org.springframework.web.struts.ContextLoaderPlugIn">
    <set-properyt property="contextConfigLocation" value="/WEB-INF/classes/applicationContext.xml"/>
   </plug-in>
 
 5:用户请求,使用spring容器取得对应的Action对象
  方案一:
  1.<controller>
   <set-property property="processorClass" value="org.springframework.web.struts.DelegatingRequestProcessor"/>
    </controller>
  2.struts-config.xml中所有的action按照正常配置则可,或者
  <action path="/list" type="org.javachina.spring_16.web.action.ListAction">
   <forward name="success" path="list.jsp"></forward>
  </action>
  3.applicationContext.xml中
  <!--以下为MVC配置-->
  <bean name="/list" class="ora.javachina.spring_16.web.action.ListAction">
   <property name="service" ref="PersonService"></property>
  </bean>
  方案二:
  1.struts-config.xml中所有的action按照正常配置则可,或者
  <action path="/list" type="org.springframework.web.struts.DelegatingActionProxy">
   <forward name="success" path="/list.jsp"></forward>
  </action>
  2.applicationContext.xml中
  <!--一下为MVC配置-->
  <bean name="/list" class="ora.javachina.spring_16.web.action.ListAction">
   <property name="service" ref="PersonService"></property>
  </bean>

转载于:https://www.cnblogs.com/liaren/archive/2012/11/19/struts_spring_hibernate.html

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值