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
        若没有再通过反射的方式生成
  • 相关阅读:
    C语言的灵魂(函数)
    GO语言测试题
    gRPC的发布订阅模式
    gRPC 介绍和简单实现
    RPC与Protobuf(五)
    RPC和Protubuf(四)
    RPC与Protobuf(三)
    JS立即执行函数的几种写法
    如何写出让人看了恶心的代码
    记录几个前端必备的库/框架
  • 原文地址:https://www.cnblogs.com/feifeiyun/p/6544399.html
Copyright © 2011-2022 走看看