首頁
編程語言
C語言|JAVA編程
Python編程
網頁編程
ASP編程|PHP編程
JSP編程
數據庫
MYSQL數據庫|SqlServer數據庫
Oracle數據庫|DB2數據庫
您现在的位置: 程式碼之家 >> 編程語言 >  >> .NET 網頁程式設計 >> ASP.NET 基礎 >> 關於ASP.NET

web.xml 學習筆記 (7):mime-mapping、welcome-file-list、error-page 詳細說明

     編輯:關於ASP.NET

10. mime-mapping:MIME 類型對應

定義副檔名與 MIME Type 對應,瀏覽器據此選擇外掛程式開啟檔案。缺少 MIME 標識可能導致系統崩潰。

<mime-mapping>
  <extension>htm</extension>
  <mime-type>text/html</mime-type>
</mime-mapping>

11. welcome-file-list:預設首頁清單

目錄請求時依順序尋找首頁檔案。

<welcome-file-list>
  <welcome-file>index.jsp</welcome-file>
  <welcome-file>index.htm</welcome-file>
</welcome-file-list>

12. error-page:錯誤頁面對應

HTTP 錯誤代碼或例外類型對應顯示頁面。

<error-page>
  <error-code>404</error-code>
  <location>/error404.jsp</location>
</error-page>
<error-page>
  <exception-type>java.lang.Exception</exception-type>
  <location>/except.jsp</location>
</error-page>

三大元素構成 Web 應用的基礎導航與錯誤處理機制。

  1. 上一篇文章:
  2. 下一篇文章:
Copyright © 程式碼之家 All Rights Reserved