日期:2014-05-17  浏览次数:20792 次

关于SSH2与SSH整合的配置文件的问题

Struts1.X版本在整合spring的时候用到代理进行整合,
<plug-in className="org.springframework.web.struts.ContextLoaderPlugIn">
  <set-property property="contextConfigLocation" value="classpath:beans.xml" />
 </plug-in>


以下是struts2版本的整合配置文件
15. <filter>
 16. <filter-name>Struts2</filter-name>
 17. <filter-class>
 18. org.apache.struts2.dispatcher.FilterDispatcher
 19. </filter-class>
 20. </filter>
 21. 
 22. <filter-mapping>
 23. <filter-name>Struts2</filter-name>
 24. <url-pattern>/*</url-pattern>
 25. </filter-mapping>
 26. <listener>
 27. <listener-class>org.springframework.web.util.Log4jConfigListener</listener-class>
 28. </listener>
 29.  
30. <!--默认加载/WEB-INF 目录下的applicationContext.xml -->
 31. <listener>
 32. <listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
 33. </listener>

请问:这两个配置文件对吗?我都给忘了

------解决方案--------------------
struts2的类似于:
XML code
<context-param>
        <param-name>contextConfigLocation</param-name>
        <param-value>
            classpath*:/applicationContext*.xml  
            /WEB-INF/applicationContext*.xml
            /WEB-INF/spring-security.xml
        </param-value>
    </context-param>
  
      <filter>
        <filter-name>springSecurityFilterChain</filter-name>
        <filter-class>org.springframework.web.filter.DelegatingFilterProxy</filter-class>
    </filter>
    <filter-mapping>
        <filter-name>springSecurityFilterChain</filter-name>
        <url-pattern>/*</url-pattern>
    </filter-mapping>
  
    <filter>
        <filter-name>struts2</filter-name>
        <filter-class>
            org.apache.struts2.dispatcher.FilterDispatcher
        </filter-class>
    </filter>
    <filter-mapping>
        <filter-name>struts2</filter-name>
        <url-pattern>/*</url-pattern>
    </filter-mapping>
    <welcome-file-list>
        <welcome-file>index.jsp</welcome-file>
    </welcome-file-list>
    <listener>
        <listener-class>
            org.springframework.web.context.ContextLoaderListener
        </listener-class>
    </listener>
    
    <context-param>
        <param-name>log4jConfigLocation</param-name>
        <param-value>/WEB-INF/log4j.properties</param-value>
    </context-param>
    
    <listener>
        <listener-class>org.springframework.web.util.Log4jConfigListener</listener-class>
    </listener>