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>

posted @ 2012-11-19 11:41  小病猫  阅读(149)  评论(0编辑  收藏  举报