web.xml中的welcome-file-list(欢迎页)
来源:互联网 发布:ubuntu c语言开发工具 编辑:程序博客网 时间:2024/06/07 03:56
例如:
<welcome-file-list>
<welcome-file>index.html</welcome-file>
<welcome-file>index.jsp</welcome-file>
<welcome-file>index.action</welcome-file>
</welcome-file-list>
直接输入localhost:8080/不是跳转到index.html,而是报404找不到的错误,根据错误信息看明显是没有跳转到index.html,意思就是说welcome-file-list根本就木有起作用。
解决问题一定要从原理入手,所以要先分析welcome-file-list是怎么工作的。
welcome-file-list的工作原理是,按照welcome-file的.list一个一个去检查是否web目录下面存在这个文件,如果存在,继续下面的工作(或者跳转到index.html页面,或者配置有struts的,会直接struts的过滤工作).如上例,先去webcontent(这里是Eclipse的工程目录根目录)下是否真的存在index.html这个文件,如果不存在去找是否存在index.jsp这个文件,以此类推。
还要说的是welcome-file不一定是html或者jsp等文件,也可以是直接访问一个action。就像我上面配置的一样,但要注意的是,一定要在webcontent下面建立一个index.action的空文件,然后使用struts配置去跳转,不然web找不到index.action这个文件,会报404错误,原因就是我之前说的那样。
如果配置了servlet的url-pattern是/*,那么访问localhost:8080/会匹配到该servlet上,而不是匹配welcome-file-list;如果url-pattern是/(该servlet即为默认servlet),如果其他匹配模式都没有匹配到,则会匹配welcome-file-list。
- 关于web.xml中的welcome-file-list(欢迎页)
- 关于web.xml中的welcome-file-list(欢迎页)
- 关于web.xml中的welcome-file-list(欢迎页)
- web.xml中的welcome-file-list(欢迎页)
- web.xml中的welcome-file-list不起作用
- web.xml中的welcome-file-list
- 关于web.xml中<welcome-file-list>
- 关于web.xml中<welcome-file-list>
- web.xml中<welcome-file-list>配置
- 关于web.xml中的<welcome-file-list>中的默认首页文件
- 关于web.xml中的<welcome-file-list>中的默认首页文件
- 为何web.xml中的welcome-file-list不能是Action地址
- web.xml之welcome-file-list、error-page
- web.xml(7)_mime-mapping、welcome-file-list、error-page
- web.xml里面的welcome-file-list是什么意思
- java web.xml welcome-file-list的默认值
- Jetty下web.xml的welcome-file-list无效
- java web.xml welcome-file-list的默认值
- IDEA 神插件:JreBel----热部署工具
- RK 3299 Ubuntu 配置密钥
- JMeter-Test Fragment
- 1. Traits基础
- C语言中常见库函数编写(占坑)
- web.xml中的welcome-file-list(欢迎页)
- Https报错状态码
- Python 运行脚本时传递参数
- 串口通信基本知识
- Mac 手动签名记录
- Spin控件使用总结
- Java初学者必知:Java语言的11大特点
- ios-知识点补充
- 基于Otsu的全局阈值处理的实现