JSF中的欢迎页面 [英] Welcome page in JSF
问题描述
如何使用JSF页面作为欢迎文件? FacesServlet
映射到*.jsf
,并且<welcome-file>
设置为index.xhtml
.但是,它没有显示JSF组件.我试图将<welcome-file>
设置为index.jsf
,但这会导致HTTP 404错误.
How can I use a JSF page as welcome file? The FacesServlet
is mapped on *.jsf
and the <welcome-file>
is set to index.xhtml
. However, it does not show the JSF components. I tried to set the <welcome-file>
to index.jsf
, but this results in a HTTP 404 error.
我正在使用Tomcat 6.0和JSF 2.1.
I'm using Tomcat 6.0 and JSF 2.1.
推荐答案
只需将index.xhtml
的<welcome-file>
条目重命名为index.jsf
,并在index.jsf
文件>欺骗该文件实际存在的容器.
Just rename <welcome-file>
entry of index.xhtml
to index.jsf
and create an empty index.jsf
file next to index.xhtml
to fool the container that the file actually exist.
或者,您也可以完全摆脱.jsf
扩展名,并完全使用.xhtml
.可以通过将FacesServlet
的<url-pattern>
从*.jsf
更改为*.xhtml
来完成.
Alternatively, you can also just get rid of the .jsf
extension altogether and use .xhtml
all the way. This can be done by changing <url-pattern>
of FacesServlet
from *.jsf
to *.xhtml
.
这篇关于JSF中的欢迎页面的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!