springmvc中的web.xml配置(包含中文乱码解决)
2024-08-30 16:53:52
<?xml version="1.0" encoding="UTF-8"?>
<web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://java.sun.com/xml/ns/javaee"
xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd" id="WebApp_ID" version="3.0">
<display-name>springmvc_01</display-name>
<welcome-file-list>
<welcome-file>index.html</welcome-file>
<welcome-file>index.htm</welcome-file>
<welcome-file>index.jsp</welcome-file>
<welcome-file>default.html</welcome-file>
<welcome-file>default.htm</welcome-file>
<welcome-file>default.jsp</welcome-file>
</welcome-file-list> <!--设置编码,这里只是post级别的编码设置, get级别的编码仍然要在server.xml中配置-->
<filter>
<filter-name>encodingFilter</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>encodingFilter</filter-name>
<url-pattern>/*</url-pattern>
</filter-mapping> <servlet>
<servlet-name>springmvc</servlet-name>
<servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class>
<init-param>
<!--设置spring.xml文件位置 一般默认是在web-inf下,现在设置的是在src下 -->
<param-name>contextConfigLocation</param-name>
<param-value>classpath:springmvc-servlet.xml</param-value>
</init-param>
<!--服务一启动就加载-->
<load-on-startup>1</load-on-startup>
</servlet>
<servlet-mapping>
<servlet-name>springmvc</servlet-name>
<url-pattern>*.action</url-pattern>
</servlet-mapping>
</web-app>
或者
<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>
最新文章
- PHP 操作mongodb api大部分方法
- Ubuntu下VSFTPD(六)(常见FTP命令及其功能) (
- C C++实现创建目录
- 第四章 jQuery中的事件
- 定义文字用em、rem,效果和px一样
- GitHub上传不了的解决 ssh: connect to host github.com port 22: Bad file number git did not exit cleanly (exit code 128)
- stringstream复用【原创】
- c++ 11 多线程教学(1)
- Sql存储过程解密方法
- 趣味Java算法题(附答案)
- [Git] 1、常用Git命令行总结(一)
- SQL运行时间
- while,until
- CNN大战验证码
- ABP之事件总线(4)
- git之win安装git和环境配置及常用命令总结
- 什么是K线?K线的详解!
- java中GZIPOutputStream 流的使用(EOFException)
- 标准的Flask启动文件
- Linux_MySql_yum_安装
热门文章
- poj - 3041 Asteroids (二分图最大匹配+匈牙利算法)
- 技术杂记之:在阿里云centos7上部署JDK MYSQL TOMCAT
- 采用jmeter和泛化测试dubbo服务接口
- Unix时间戳(Unix timestamp)转换
- 使用OpenCV读、操作、写图像并与bash合作对某个文件夹下全部图像进行相似处理
- [Erlang危机](5.1.4)端口port
- cocos2d-x 求相交矩阵
- MongDB应用
- jeasyui控件事件和方法的使用方法
- [办公自动化]凭证纸打印 IE 默认设置