zoukankan      html  css  js  c++  java
  • spring整合struts2

    spring整合struts2的核心思想:

      1.在spring整和javaWeb的基础上

      2.在spring的配置文件中配置Action类

     导入的包

      struts2:多加一个struts2-spring-plugin-2.3.15.3.jar(加这个包是为了实现下面的第3点)
      spring:多加spring-web-4.0.0.RELEASE.jar和spring-webmvc-4.0.0.RELEASE.jar

    note.txt

    如何整合struts2
        目标:用IOC容器管理Action类
        1.加入jar包
            struts2:多加一个struts2-spring-plugin-2.3.15.3.jar(加这个包是为了实现下面的第3点)
            spring:多加spring-web-4.0.0.RELEASE.jar和spring-webmvc-4.0.0.RELEASE.jar
            
        2.在spring配置文件中配置Action类
            因为struts中Action对象不是单实例的所以在bean节点加上scope="prototype"
            <bean id="personAction" class="ss_actions.PersonAction" scope="prototype"></bean>
            
        3.在struts.xml中配置时action节点的class属性要为bean节点上的id属性
            <action name="personFrom" class="personAction">
            
        具体原理在    struts2-spring-plugin-2.3.15.3.jar        中
        会首先从配好的IOC容器中找对应id的Action的bean
        若没有再通过反射的方式生成
  • 相关阅读:
    超神头文件
    世界上还有比二分更容易错的算法吗?
    【POJ 1734】Sightseeing trip
    P1303 A*B Problem
    P1601 A+B Problem(高精)
    P1051 谁拿了最多奖学金
    【P1025】数的划分
    P1005 矩阵取数游戏
    P1006 传纸条
    邮票问题
  • 原文地址:https://www.cnblogs.com/feifeiyun/p/6544399.html
Copyright © 2011-2022 走看看