在线观看不卡亚洲电影_亚洲妓女99综合网_91青青青亚洲娱乐在线观看_日韩无码高清综合久久

鍍金池/ 教程/ Linux/ Servlet web.xml welcome-file-list
Servlet web.xml welcome-file-list
Servlet從數(shù)據(jù)庫讀取記錄性能優(yōu)化
Servlet URL重寫帶參數(shù)
War文件
Web技術(shù)基礎(chǔ)
Servlet GenericServlet類
Servlet API
Servlet ServletInputStream類
使用MyEclipse創(chuàng)建Servlet
Servlet增刪改查
Servlet ServletConfig配置信息
Servlet Cookies
Servlet重定向
Servlet生命周期
Servlet HttpSession會話
Servlet HttpServlet類
Servlet注冊表單示例
Servlet表單隱藏字段
Servlet下載文件
Servlet教程
Servlet身份驗證過濾器
Servlet ServletOutputStream類
Servlet HttpSession登錄注銷實例
Servlet啟動時加載
Servlet事件和監(jiān)聽器
使用Eclipse創(chuàng)建Servlet
Servlet ServletContextEvent事件
Servlet HttpSessionEvent統(tǒng)計在線用戶數(shù)實例
Servlet RequestDispatcher請求轉(zhuǎn)發(fā)
Servlet使用注釋
Servlet過濾器示例
Servlet過慮器
Servlet ServletContext配置信息
Servlet登錄注銷Cookies實例
Servlet工作流程
Servlet會話跟蹤
Servlet登錄實例
Servlet ServletRequest接口
Servlet ServletRequestEvent類和接口
Servlet入門程序
Servlet查詢搜索數(shù)據(jù)示例
Servlet FilterConfig應(yīng)用示例
Servlet顯示所有頭信息
Servlet屬性設(shè)置
使用NetBeans創(chuàng)建Servlet
Servlet接口實現(xiàn)
Servlet上傳文件

Servlet web.xml welcome-file-list

web.xml文件中的web-app塊的welcome-file-list子元素用于定義歡迎文件列表。 它的子元素是welcome-file,用于定義歡迎文件(即默認(rèn)打開的頁面)。

歡迎文件是服務(wù)器自動調(diào)用的文件,如果不指定任何文件名。

默認(rèn)情況下,服務(wù)器按以下順序查找歡迎文件:

  1. web.xml文件中的welcome-file-list指定的文件
  2. index.html
  3. index.html
  4. index.jsp

如果沒有找到這些文件,服務(wù)器會報告404錯誤。

如果在web.xml中指定了welcome-file,并且所有文件index.htmlindex.htmlindex.jsp都存在,那么優(yōu)先級將轉(zhuǎn)到welcome-file。

如果web.xml文件中不存在welcome-file-list項,那么優(yōu)先級到index.html文件,然后是index.html,以及最后是index.jsp文件。

下面來看看一個定義歡迎文件的web.xml文件。

<?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>helloworld</display-name>
    <welcome-file-list>
        <welcome-file>index.html</welcome-file>
        <welcome-file>index.jsp</welcome-file>
        <welcome-file>home.jsp</welcome-file>
    </welcome-file-list>
</web-app>

現(xiàn)在,index.html,index.jsphome.jsp將是歡迎文件。

如果有歡迎文件,可以按如下所示的方式調(diào)用項目:

http://localhost:8888/helloproject

如上所示,我們并沒有在項目名稱(helloproject)之后指定任何文件名。上面URL訪問相當(dāng)于以下三個 -

http://localhost:8888/helloproject/index.html
http://localhost:8888/helloproject/index.jsp
http://localhost:8888/helloproject/home.jsp

上一篇:Servlet過濾器示例下一篇:Servlet教程