struts2+spring 配置

<?xml version="1.0" encoding="UTF-8"?>
<web-app version="2.4" xmlns="http://java.sun.com/xml/ns/j2ee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee
http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd">

<welcome-file-list>
    <welcome-file>index.jsp</welcome-file>
  </welcome-file-list>
<!-- 所有MVC框架都需要web应用加载一个核心控制器,对于struts2来说,核心控制器就是FilterDispatcher -->
<filter>
<filter-name>struts2</filter-name>
<filter-class>
org.apache.struts2.dispatcher.FilterDispatcher
</filter-class>
</filter>

<!-- 配置Filter拦截的URL -->
<filter-mapping>
<!-- 配置Struts2的核心FilterDispatcher拦截所有用户的请求 -->
<filter-name>struts2</filter-name>
<url-pattern>/*</url-pattern>
</filter-mapping>


<!-- 用来定位Spring XML文件的上下文配置 -->  
<context-param>  
    <param-name>contextConfigLocation</param-name>  
    <param-value>
        classpath*:applicationContext.xml,classpath*:applicationContext-*.xml
    </param-value>  
</context-param>

<!-- 配置Spring监听器 -->
<listener>
<listener-class>
org.springframework.web.context.ContextLoaderListener
</listener-class>
</listener>

<!--
Location of the log4j config file. for intialization and fresh checks.
Applied by Log4jConfigListener
-->
<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>
</web-app>

你可能感兴趣的:(spring,log4j,Web,mvc,xml)