【发布时间】:2014-04-10 11:07:07
【问题描述】:
假设我在项目中有以下文件夹结构:
webapp
|-admin
|--adminfile1.xhtml
|--adminfile2.xhtml
|-user
|--userfile1.xhtml
|--userfile2.xhtml
|login.xhtml
在我的 web.xml 我有这个欢迎文件的定义
<welcome-file-list>
<welcome-file>login.xhtml</welcome-file>
</welcome-file-list>
我希望 web.xml 欢迎文件始终指向 index.xhtml 文件,但如果我调用 http://webappname/admin/,服务器会尝试调用 http://webappname/admin/index.xhtml 而不是 http://webappname/index.xhtml
所以我尝试使用 / 作为第一个字符,在根文件夹中搜索。 web.xml 如下所示:
<welcome-file-list>
<welcome-file>/login.xhtml</welcome-file>
</welcome-file-list>
但现在它搜索http://webappname//admin//login.xhtml
如何调用根文件夹中的文件?没有解决方案吗?我是否必须在每个文件夹中都放置重定向才能获得结果?
【问题讨论】:
标签: java jsf jakarta-ee web.xml