Why can web.xml welcome-file be located inside WEB-INF

好久不见. 提交于 2019-12-06 23:42:40
BalusC

It's because the welcome file is served by a RequestDispatcher#forward() call. As evidence, do you see /WEB-INF/page.jsp appearing in browser's address bar? No? Then it's already most definitely not a direct request. If you attempt to request it directly, you'll see that you get a 404.

See also:


Unrelated to the concrete problem, you seem to be basically abusing the <welcome-file> to have a "homepage file". There it is not intented for. It's intented to specify the sole filename of the folder's file you'd like to serve up when any folder is been requested, such as /, /foo/, /foo/bar/, etc. If you specify index.jsp, then the /index.jsp, /foo/index.jsp, /foo/bar/index.jsp, etc will transparently be served up by a forward without a change in URL.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!