web.xml中的welcome-file认识
2015-08-31 00:00
260 查看
以前只知道welcome-file是用于配置首页地址,当访问域名时自动进入对应的页面,所以一直以为这个配置的是一个绝对地址。最近在一次测试中发现输入一个没有配置nginx的地址竟然可以进入一个页面,查了很久只有welcome-file这个最可疑,于是才去深扒它的说明(好吧,我承认我基础差)
顺便吐槽下,查说明只有去英文网站才查到,中文的都是说怎么用.......
This tag specifies the relative path of a single welcome file.
A welcome file is provided when the web application is accessed using only the domain name, or with any other URL that ends with a slash.
Welcome files must exist as physical files in your application, or in Servlets 2.4 and above can also be servlets that are defined in web.xml.
The page or servlet should be specified without any leading slash. Only relative paths can be specified.
OK,了解了,也就是说welcome-file配置的是相对地址,当地址只有域名或是以斜杠结尾的时候,就会匹配到welcome-file中的相对地址里,举例说明:
web.xml配置:
则www.baidu.com就会匹配为www.baidu.com/index.jsp
这也是最常用的大家都懂得
但如果地址为www.baidu.com/admin,则会匹配为www.baidu.com/admin/index.jsp
这个容易被别人忽略,当然提前是没有被nginx、filter或服务器拦截到而且确实有admin/index.jsp这个文件
好了,记录一下以免忘记,大神可以直接回复:然并卵......
顺便吐槽下,查说明只有去英文网站才查到,中文的都是说怎么用.......
This tag specifies the relative path of a single welcome file.
A welcome file is provided when the web application is accessed using only the domain name, or with any other URL that ends with a slash.
Welcome files must exist as physical files in your application, or in Servlets 2.4 and above can also be servlets that are defined in web.xml.
The page or servlet should be specified without any leading slash. Only relative paths can be specified.
OK,了解了,也就是说welcome-file配置的是相对地址,当地址只有域名或是以斜杠结尾的时候,就会匹配到welcome-file中的相对地址里,举例说明:
web.xml配置:
<welcome-file-list> <welcome-file>index.jsp</welcome-file> </welcome-file-list>
则www.baidu.com就会匹配为www.baidu.com/index.jsp
这也是最常用的大家都懂得
但如果地址为www.baidu.com/admin,则会匹配为www.baidu.com/admin/index.jsp
这个容易被别人忽略,当然提前是没有被nginx、filter或服务器拦截到而且确实有admin/index.jsp这个文件
好了,记录一下以免忘记,大神可以直接回复:然并卵......
相关文章推荐
- TQ335x——spidev驱动的生成
- 通达OA2015年全国巡回培训会引爆羊城
- 为Action的属性注入值
- 指定struts2处理的请求后缀
- web设计——表格
- struts中常量的定义和一些常用的常量
- struts2的处理流程
- 为应用指定多个配置文件
- 堆栈
- request.getHeader("referer")的作用
- Eclipse 添加 tomcat 修改server.xml 重启后失效
- sql语句修改mysql表的自增主键
- Mysql 大小写问题
- android通过httpClient请求获取JSON数据并且解析
- 创业的第二十九天
- Google提供的Python学习课程
- web服务器和应用服务器的区别?
- HashMap为什么是线程不安全的?
- LRU缓存设计-踩坑学习
- HtmlUnit 网络爬虫 菜鸟的学习笔记(一)