<?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>rrr</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 方式的中文亂碼解決 -->
<filter>
<filter-name>characterEncoding</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>
</filter>
<filter-mapping>
<filter-name>characterEncoding</filter-name>
<url-pattern>/*</url-pattern>
</filter-mapping>
<!-- 配置HiddenHttpMethodFilter,將 post轉(zhuǎn)為 put or delete提交方式 -->
<filter>
<filter-name>HiddenHttpMethodFilter</filter-name>
<filter-class>org.springframework.web.filter.HiddenHttpMethodFilter</filter-class>
</filter>
<filter-mapping>
<filter-name>HiddenHttpMethodFilter</filter-name>
<url-pattern>/*</url-pattern>
</filter-mapping>
<!-- 引入springmvc 核心控制器 -->
<servlet>
<servlet-name>DispatcherServlet</servlet-name>
<servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class>
<!-- 加載springmvc的配置文件 -->
<init-param>
<param-name>contextConfigLocation</param-name>
<!-- classpath 表示 WEB-INF/classes -->
<param-value>classpath:spring-mvc.xml</param-value>
</init-param>
<!-- tomcat啟動時(shí),創(chuàng)建DispatcherServlet對象 -->
<load-on-startup>1</load-on-startup>
</servlet>
<servlet-mapping>
<servlet-name>DispatcherServlet</servlet-name>
<!-- 訪問靜態(tài)資源時(shí),因?yàn)槁窂娇梢云ヅ渖希蜁L問DispatcherServlet,但是DispatcherServlet默認(rèn)情況下,不處理靜態(tài)資源,所以報(bào)404 -->
<url-pattern>/</url-pattern>
</servlet-mapping>
<!-- 引入spring的配置文件 -->
<!-- spring的核心配置 -->
<context-param>
<param-name>contextConfigLocation</param-name>
<!-- 設(shè)置spring的配置文件的路徑 -->
<param-value>classpath:spring-bean.xml</param-value>
<!-- <param-value>/WEB-INF/classes/bean.xml</param-value> -->
</context-param>
<listener>
<listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
</listener>
</web-app>
web-xml
?著作權(quán)歸作者所有,轉(zhuǎn)載或內(nèi)容合作請聯(lián)系作者
【社區(qū)內(nèi)容提示】社區(qū)部分內(nèi)容疑似由AI輔助生成,瀏覽時(shí)請結(jié)合常識與多方信息審慎甄別。
平臺聲明:文章內(nèi)容(如有圖片或視頻亦包括在內(nèi))由作者上傳并發(fā)布,文章內(nèi)容僅代表作者本人觀點(diǎn),簡書系信息發(fā)布平臺,僅提供信息存儲服務(wù)。
【社區(qū)內(nèi)容提示】社區(qū)部分內(nèi)容疑似由AI輔助生成,瀏覽時(shí)請結(jié)合常識與多方信息審慎甄別。
平臺聲明:文章內(nèi)容(如有圖片或視頻亦包括在內(nèi))由作者上傳并發(fā)布,文章內(nèi)容僅代表作者本人觀點(diǎn),簡書系信息發(fā)布平臺,僅提供信息存儲服務(wù)。
相關(guān)閱讀更多精彩內(nèi)容
- 關(guān)于web.xml中的welcome-file-list 這個(gè)配置用于配置項(xiàng)目的初始頁面。輸入http://loc...
- Spring MVC中,applicationContext.xml [ServletName]-servlet....
- 正常情況下springmvc的xml文件應(yīng)放在WEB-INF下,命名規(guī)則為[name]-servlet.xml, ...
- 溫馨提示:本文閱讀需要3分鐘,建議收藏后閱讀! XML 伙伴們應(yīng)該不陌生吧! 我們之前總是要配置 web.xml ...
- 創(chuàng)建一個(gè)maven項(xiàng)目 pom.xml出現(xiàn)如下錯(cuò)誤:web.xml is missing and <failOnM...