web.xml里面的welcome-file-list是什么意思

为了解决在eclipse打开工程里面随意一个网页都能正常显示时,写过的页面都要加进web.xml的welcome-file-list里面,例如

    <welcome-file-list>
        <welcome-file>index.jsp</welcome-file>
        <welcome-file>buy31-35.html</welcome-file>
        <welcome-file>favorite.html</welcome-file>
        <welcome-file>MyFavorite.html</welcome-file>
        <welcome-file>payFail.html</welcome-file>
        <welcome-file>PayIt.htm</welcome-file>
        <welcome-file>paysucess.htm</welcome-file>
        <welcome-file>default.jsp</welcome-file>
    </welcome-file-list>

表示里面含有index.jsp、buy31-35.html等页面,运行工程时默认显示顺序第一的页面,在这里面也就是index.jsp页面。

如果:

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

里面没有把buy31-35.html加进去,即使工程里面含有这个页面,运行此页面时也是不能打开的,打开的只能是默认的index.jsp页面。



另外 index.jsp我们一般都是删掉,重新新建自己的html或者是jsp等页面,这里index.jsp其实有一个作用,index.jsp页面是和WebRoot同级的,我们新建页面时一般习惯也和WebRoot同级,其实这样不安全,这样容易被人家发现源代码,为了保护源代码,可以把自己写的页面放进Web-INF下,意思页面的信息,是不允许别人看到的。这样在index.jsp里的body还要加一个设置<jsp:forward page="buy31-35.html"></jsp:forward>意思是index.jsp跳转到自己写的buy31-35.html页面。

  • 0
    点赞
  • 4
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值