SpringMvc xml 配置

<?xml version="1.0" encoding="UTF-8"?>
<web-app version="2.5" 
	xmlns="http://java.sun.com/xml/ns/javaee" 
	xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
	xsi:schemaLocation="http://java.sun.com/xml/ns/javaee 
	http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd">
 <servlet>
 	<servlet-name>DispatcherServlet</servlet-name>
 	<servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class>
 	<!-- 通知DispatcherServlet去指定的目录下加载springmvc.xml配置文件 -->
 	<!-- 在默认的情况下SpringMvc会去找/WEB-INF/<servlet-name>-servlet.xml -->
 	<init-param>
 		<param-name>contextConfigLocation</param-name>
 		<param-value>classpath:springmvc.xml</param-value>
 	</init-param>
 </servlet>
 <servlet-mapping>
 	<servlet-name>DispatcherServlet</servlet-name>
 	<url-pattern>*.action</url-pattern>
 </servlet-mapping>
 
 <!-- 注册Spring提供的处理Post请求的乱码问题 -->
 <filter>  
    <filter-name>CharacterEncodingFilter</filter-name>  
    <filter-class>org.springframework.web.filter.CharacterEncodingFilter</filter-class>  
    <init-param>  
        <param-name>encoding</param-name>  
        <param-value>utf-8</param-value>  
    </init-param>  
</filter>  
<filter-mapping>  
    <filter-name>CharacterEncodingFilter</filter-name>  
    <url-pattern>/*</url-pattern>  
</filter-mapping>
</web-app>

  

posted @ 2015-12-10 21:34  huangcqen  阅读(174)  评论(0编辑  收藏  举报