SSM_OA的web.xml文件简单配置

来源:互联网 发布:阴阳师神龙强化数据 编辑:程序博客网 时间:2024/05/16 14:16
<?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_2_5.xsd"    id="WebApp_ID" version="2.5">    <display-name>SSM_OA</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>    <!--将所有请求的数据在spring中指定为utf8编码 -->    <filter>        <filter-name>Set Character Encoding</filter-name>        <filter-class>org.springframework.web.filter.CharacterEncodingFilter</filter-class>        <init-param>            <param-name>encoding</param-name>            <param-value>utf8</param-value>        </init-param>        <!-- 即使request请求已经包含编码格式,但是要求按照过滤的编码格式来进行编码 -->        <init-param>            <param-name>forceEncoding</param-name>            <param-value>true</param-value>        </init-param>    </filter>    <filter-mapping>        <filter-name>Set Character Encoding</filter-name>        <url-pattern>/*</url-pattern>    </filter-mapping>    <!-- Spring配置文件引入 -->    <context-param>        <param-name>contextConfigLocation</param-name>        <param-value>                   classpath:config/spring-context.xml        </param-value>    </context-param>    <!-- 配置监听器后,启动Tomcat服务器的时候就可启动Spring容器,从而执行spring-context.xml配置文件信息 -->    <listener>        <listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>    </listener>    <!-- springMVC配置 -->    <servlet>        <servlet-name>spring</servlet-name>        <servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class>        <init-param>            <param-name>contextConfigLocation</param-name>            <param-value>classpath:config/spring-servlet.xml</param-value>        </init-param>        <load-on-startup>1</load-on-startup>    </servlet>    <servlet-mapping>        <servlet-name>spring</servlet-name>        <url-pattern>/</url-pattern><!-- /,/*:所有请求都需要过滤 *.json:所有以.json结尾的请求都需要过滤 -->    </servlet-mapping></web-app>
原创粉丝点击