• Spring与Struts2整合


    第一步:在web.xml文件中Spring的监听器

    <!-- 配置Spring的用于初始化容器对象的监听器 -->
    <listener>
      <listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
    </listener>
    <context-param>
      <param-name>contextConfigLocation</param-name>
      <param-value>classpath:applicationContext*.xml</param-value>
    </context-param>

    这两个配置信息可到-----》》spring-framework-2.5.6.SEC01/docs/reference/html_single/index.html下的15.2. Common configuration中找到。


    第二步:再加一个jar包

    struts2-spring-plugin-2.1.8.1.jar

    这个包在struts-2.1.8.1lib下。


    测试是否成功整合

    <package name="default" namespace="/" extends="struts-default">
    <!-- 配置测试用的Action,未与Spring整合,class属性写类的全名 -->
    <!-- 当Struts与Spring整合后,class属性可以写bean的名称 -->
    <action name="test" class="testAction">
    <result name="SUCCESS">/test.jsp</result>
    </action>
    </package>

    未整合前class值是cn.itcast.oa.test.TestAction


    再测试下如果成功说明整合成功了。。。。

  • 相关阅读:
    numpy用法介绍-未完待续
    GeoJSON相关操作
    awk日志分析
    awk获取外部变量
    Shell编程二
    Shell编程
    Linux监控平台搭建
    Linux集群架构
    Linux集群
    MySQL主从(MySQL proxy Lua读写分离设置,一主多从同步配置,分库分表方案)
  • 原文地址:https://www.cnblogs.com/justdoitba/p/7582160.html
Copyright © 2020-2023  润新知