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

鍍金池/ 教程/ Linux/ Servlet web.xml welcome-file-list
Servlet web.xml welcome-file-list
Servlet從數(shù)據(jù)庫(kù)讀取記錄性能優(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會(huì)話
Servlet HttpServlet類
Servlet注冊(cè)表單示例
Servlet表單隱藏字段
Servlet下載文件
Servlet教程
Servlet身份驗(yàn)證過(guò)濾器
Servlet ServletOutputStream類
Servlet HttpSession登錄注銷實(shí)例
Servlet啟動(dòng)時(shí)加載
Servlet事件和監(jiān)聽器
使用Eclipse創(chuàng)建Servlet
Servlet ServletContextEvent事件
Servlet HttpSessionEvent統(tǒng)計(jì)在線用戶數(shù)實(shí)例
Servlet RequestDispatcher請(qǐng)求轉(zhuǎn)發(fā)
Servlet使用注釋
Servlet過(guò)濾器示例
Servlet過(guò)慮器
Servlet ServletContext配置信息
Servlet登錄注銷Cookies實(shí)例
Servlet工作流程
Servlet會(huì)話跟蹤
Servlet登錄實(shí)例
Servlet ServletRequest接口
Servlet ServletRequestEvent類和接口
Servlet入門程序
Servlet查詢搜索數(shù)據(jù)示例
Servlet FilterConfig應(yīng)用示例
Servlet顯示所有頭信息
Servlet屬性設(shè)置
使用NetBeans創(chuàng)建Servlet
Servlet接口實(shí)現(xiàn)
Servlet上傳文件

Servlet web.xml welcome-file-list

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

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

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

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

如果沒(méi)有找到這些文件,服務(wù)器會(huì)報(bào)告404錯(cuò)誤。

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

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

下面來(lái)看看一個(gè)定義歡迎文件的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.htmlindex.jsphome.jsp將是歡迎文件。

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

http://localhost:8888/helloproject

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

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