SpringMVC-提高篇-web.xml

<?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" xmlns:web="http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd" 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>SpringMVCPingJie</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>




<!-- SpringMVC過濾器(就是一個servlet) --> 
<!-- 每次發送請求是希望進入到SpringMVC裏 -->
<servlet>
  <servlet-name>DispatcherServlet</servlet-name>
  <servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class> 
  <!-- 初始化參數(前端控制器把請求交給“contextConfigLocation”指明的配置文件) -->
  <init-param>
  <param-name>contextConfigLocation</param-name>
  <!-- 文件的名字必須是servlet的名字-servlet.xml -->
  <param-value>/WEB-INF/DispatcherServlet-servlet.xml</param-value>
  </init-param>
  <!-- 下面這行的意思是如果有請求優先訪問這個servlet -->
  <load-on-startup>1</load-on-startup>
</servlet>


<servlet-mapping>
  <servlet-name>DispatcherServlet</servlet-name>
  <!-- 只要是“/”都要經過上面那個名字 -->
  <url-pattern>/</url-pattern>
</servlet-mapping>




</web-app>






<!-- ========================================================== -->


<!-- 單詞 -->
<!-- dispatcher[dɪs'pætʃə]n. 調度員;[計] 調度程序;[計] 分配器 -->
<!-- servlet['sɜːvlət]n. 伺服小程式;小服務程序 -->
發佈了38 篇原創文章 · 獲贊 2 · 訪問量 1萬+
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章