配置web.xml文件
2018-01-29 18:52
169 查看
<?xml version="1.0" encoding="UTF-8"?>
<web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns="http://xmlns.jcp.org/xml/ns/javaee"
xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/javaee http://xmlns.jcp.org/xml/ns/javaee/web-app_3_1.xsd" id="WebApp_ID" version="3.1">
<display-name>ssm</display-name>
<!-- 过滤器解决中文乱码问题、强制编码 UTF-8 -->
<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>
<init-param>
<param-name>forceRequestEncoding</param-name>
<param-value>true</param-value>
</init-param>
</filter>
<filter-mapping>
<filter-name>characterEncodingFilter</filter-name>
<url-pattern>/*</url-pattern>
</filter-mapping>
<!-- 配置 springMVC 基本配置 -->
<servlet>
<servlet-name>springMVC</servlet-name>
<servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class>
<init-param>
<param-name>contextConfigLocation</param-name>
<param-value>classpath:spring-mvc.xml</param-value>
</init-param>
<load-on-startup>1</load-on-startup>
</servlet>
<servlet-mapping>
<servlet-name>springMVC</servlet-name>
<url-pattern>/</url-pattern>
</servlet-mapping>
<!-- 配置 spring 监听器 -->
<!-- needed for ContextLoaderListener -->
<context-param>
<param-name>contextConfigLocation</param-name>
<param-value>classpath:applicationContext.xml</param-value>
</context-param>
<!-- Bootstraps the root web application context before servlet initialization -->
<listener>
<listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
</listener>
<!-- 配置欢迎页 -->
<welcome-file-list>
<welcome-file>views/index.jsp</welcome-file>
</welcome-file-list>
</web-app>
<web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns="http://xmlns.jcp.org/xml/ns/javaee"
xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/javaee http://xmlns.jcp.org/xml/ns/javaee/web-app_3_1.xsd" id="WebApp_ID" version="3.1">
<display-name>ssm</display-name>
<!-- 过滤器解决中文乱码问题、强制编码 UTF-8 -->
<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>
<init-param>
<param-name>forceRequestEncoding</param-name>
<param-value>true</param-value>
</init-param>
</filter>
<filter-mapping>
<filter-name>characterEncodingFilter</filter-name>
<url-pattern>/*</url-pattern>
</filter-mapping>
<!-- 配置 springMVC 基本配置 -->
<servlet>
<servlet-name>springMVC</servlet-name>
<servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class>
<init-param>
<param-name>contextConfigLocation</param-name>
<param-value>classpath:spring-mvc.xml</param-value>
</init-param>
<load-on-startup>1</load-on-startup>
</servlet>
<servlet-mapping>
<servlet-name>springMVC</servlet-name>
<url-pattern>/</url-pattern>
</servlet-mapping>
<!-- 配置 spring 监听器 -->
<!-- needed for ContextLoaderListener -->
<context-param>
<param-name>contextConfigLocation</param-name>
<param-value>classpath:applicationContext.xml</param-value>
</context-param>
<!-- Bootstraps the root web application context before servlet initialization -->
<listener>
<listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
</listener>
<!-- 配置欢迎页 -->
<welcome-file-list>
<welcome-file>views/index.jsp</welcome-file>
</welcome-file-list>
</web-app>
相关文章推荐
- 在web.xml文件中配置信息,未起作用问题解决
- web.xml文件的作用----简单描述项目常见的几个配置
- spring mvc学习笔记(一)web.xml文件配置的一点重要信息
- JSP中web.xml文件的作用及基本配置
- springMVC web.xml配置文件参考
- web.xml文件中配置mime下载文件类型
- 基于注解的Struts2+Spring2.5+Hibernate3.3的Spring 配置文件,struts配置文件,web.xml配置文件的例子
- web.xml中配置applicationContext.xml 配置文件的存放位置
- web.xml文件中的配置启动顺序
- web.xml配置文件元素详解
- web.xml文件的作用及基本配置
- 如何获得(读取)web.xml配置文件的參数
- 第2.1.6章 WEB系统最佳实践Spring文件配置之spring-hessian-client.xml
- xml读取properties配置文件,web.xml读取properties,properties格式,properties在eclipse创建
- web.xml文件的作用及基本配置
- web.xml配置文件详解
- web.xml配置文件中<async-supported>true</async-supported>报错的解决方案
- log4J配置及在web.xml文件中的配置
- 【Java Web】——配置文件的格式之xml和properties的区分
- web.xml配置文件顺序