• 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>

  • 相关阅读:
    Java学习之集合(HashSet)
    Java学习之集合(LinkedList链表集合)
    Java学习之集合(List接口)
    Java学习之集合(Collection接口)
    【Spring Session】和 Redis 结合实现 Session 共享
    【NodeJS】nvm
    【Html JS】使用问题记录
    【VUE】使用问题记录
    【RabbitMQ】显示耗时处理进度
    【CentOS7】开发环境配置
  • 原文地址:https://www.cnblogs.com/liaren/p/struts_spring_hibernate.html
Copyright © 2020-2023  润新知