<? version=\"1.0\" encoding=\"UTF-8\"?>
<web-app ns:xsi=\"http://www.w3.org/2001/ Schema-instance\"
ns=\"http://java.sun.com/ /ns/javaee\"
xsi:schemaLocation=\"http://java.sun.com/ /ns/javaee
http://java.sun.com/ /ns/javaee/web-app_2_5.xsd\"
id=\"WebApp_ID\" version=\"2.5\">
<!--1.启动Spring的容器 -->
<!-- needed for ContextLoaderListener -->
<context-param>
<param-name>contextConfigLocation</param-name>
<param-value>classpath:applicationContext. </param-value>
</context-param>
<!-- Bootstraps the root web application context before servlet initialization -->
<listener>
<listener-class>org.spring work.web.context.ContextLoaderListener</listener-class>
</listener>
<!--2.springmvc的前端控制器,拦截所有请求 -->
<!-- The front controller of this Spring Web application, responsible for handling all application requests -->
<servlet>
<servlet-name>dispatcherServlet</servlet-name>
<servlet-class>org.spring work.web.servlet.DispatcherServlet</servlet-class>
<load-on-startup>1</load-on-startup>
</servlet>
<!-- Map all requests to the DispatcherServlet for handling -->
<servlet-mapping>
<servlet-name>dispatcherServlet</servlet-name>
<url-pattern>/</url-pattern>
</servlet-mapping>
<!--3.字符编码过滤器 ,一定要放在所有过滤器之前 -->
<filter>
<filter-name>CharacterEncodingFilter</filter-name>
<filter-class>org.spring work.web.filter.CharacterEncodingFilter</filter-class>
<init-param>
<param-name>encoding</param-name>
<param-value>utf-8</param-value>
</init-param>
<init-param>
<param-name>forceRequestEncoding</param-name>
<param-value>true</param-value>
</init-param>
<init-param>
<param-name>forceResponseEncoding</param-name>
<param-value>true</param-value>
</init-param>
</filter>
<filter-mapping>
<filter-name>CharacterEncodingFilter</filter-name>
<url-pattern>/*</url-pattern>
</filter-mapping>
<!-- 4.使用Rest风格的Url,将页面普通的post请求转为指定的delete或者put请求-->
<filter>
<filter-name>HiddenHttpMethodFilter</filter-name>
<filter-class>org.spring work.web.filter.HiddenHttpMethodFilter</filter-class>
</filter>
<filter-mapping>
<filter-name>HiddenHttpMethodFilter</filter-name>
<url-pattern>/*</url-pattern>
</filter-mapping>
<!-- 用于处理ajax不能直接发送put请求的过滤器 -->
<filter>
<filter-name>HttpPutFormContentFilter</filter-name>
<filter-class>org.spring work.web.filter.HttpPutFormContentFilter</filter-class>
</filter>
<filter-mapping>
<filter-name>HttpPutFormContentFilter</filter-name>
<url-pattern>/*</url-pattern>
</filter-mapping>
</web-app>
继续阅读与本文标签相同的文章
上一篇 :
感谢中国人 非洲用户盛赞中国智能手机
下一篇 :
任天堂北美前CEO雷吉获游戏界“传奇奖”
-
Zabbix + Cloud Alert 实践分享
2026-05-18栏目: 教程
-
阿里云容器服务通过LoadBalancer暴露IPv6服务
2026-05-18栏目: 教程
-
阿里云服务器通用网络增强型实例sn2ne 独享主机速度快 适合企业公司使用
2026-05-18栏目: 教程
-
flex布局和grid布局
2026-05-18栏目: 教程
-
语音顶会Interspeech 论文解读|Constrained output embeddings for end-to-end code-switching speech recognition with only monolingual data
2026-05-18栏目: 教程
