导航

Web.XML

 1 <?xml version="1.0" encoding="utf-8"?>
 2 <web-app xmlns="http://xmlns.jcp.org/xml/ns/javaee"
 3          xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
 4          xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/javaee
 5                       http://xmlns.jcp.org/xml/ns/javaee/web-app_3_1.xsd"
 6          version="3.1">
 7 <!--头信息配置2.5以上,否则jsp页面需要加isELIgnored="false"才能使用EL表达式-->
 8   <display-name>Archetype Created Web Application</display-name>
 9 
10     <!--    配置spring的监听器,默认只加载WEB-INF目录下的application.xml配置文件-->
11     <listener>
12         <listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
13     </listener>
14     <!--    设置配置spring文件路径-->
15     <context-param>
16         <param-name>contextConfigLocation</param-name>
17         <param-value>classpath:applicationContext.xml</param-value>
18     </context-param>
19 <!--    解决中文乱码的过滤器-->
20     <filter>
21         <filter-name>characterEncodingFilter</filter-name>
22         <filter-class>org.springframework.web.filter.CharacterEncodingFilter</filter-class>
23         <init-param>
24             <param-name>encoding</param-name>
25             <param-value>utf-8</param-value>
26         </init-param>
27     </filter>
28     <filter-mapping>
29         <filter-name>characterEncodingFilter</filter-name>
30         <url-pattern>/*</url-pattern>
31     </filter-mapping>
32     <!--    配置前端控制器-->
33     <servlet>
34         <servlet-name>dispatcherServlet</servlet-name>
35         <servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class>
36         <!--        加载springmvc.xml配置文件-->
37         <init-param>
38             <param-name>contextConfigLocation</param-name>
39             <param-value>classpath:springmvc.xml</param-value>
40         </init-param>
41         <!--        启动服务器,创建该servlet-->
42         <load-on-startup>1</load-on-startup>
43     </servlet>
44     <servlet-mapping>
45         <servlet-name>dispatcherServlet</servlet-name>
46         <url-pattern>/</url-pattern>
47     </servlet-mapping>
48 </web-app>

 

posted on 2019-06-28 23:45  尖尖剑🗡  阅读(101)  评论(0编辑  收藏  举报