servlet的web站点欢迎页面配置

  • 一个web站点的欢迎页面(没有指定任何“资源路径”的时候会默认访问欢迎页面)
  • 在web.xml文件中进行了以下的配置:

    <welcome-file-list>
            <welcome-file>login.html</welcome-file>
    </welcome-file-list>
    
    <!--注意:路径不需要以“/”开始,路径默认从webapp的根下开始找。-->
  • 一个webapp是可以设置多个欢迎页面的:
    <welcome-file-list>
        <welcome-file>page1/page.html</welcome-file>
        <welcome-file>page2/page.html</welcome-file>
        <welcome-file>login.html</welcome-file>
    </welcome-file-list>
    <!--注意:越靠上的优先级越高,找不到的继续向下找-->
  • 配置方式:
    • 一个是在webapp内部的web.xml文件中。(局部配置)
    • 一个是在Tomcat的目录:apache-tomcat/conf/web.xml文件中进行配置。(全局配置)
    • <welcome-file-list>
          <welcome-file>index.html</welcome-file>
          <welcome-file>index.htm</welcome-file>
          <welcome-file>index.jsp</welcome-file>
      </welcome-file-list>
      <!--注意原则:局部优先原则。-->
    • 如果你一个web站点没有设置局部的欢迎页面,Tomcat服务器就会以index.html、index.htm、index.jsp作为一个web站点的欢迎页面。  
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值