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.
I'm using Tomcat 6.0 and JSF 2.1.
Adding it to your welcome-file-list like this:
Does work, but you'll need Tomcat 7.
Another approach which also works with Tomcat 6 is adding a file called index.jsp with the following contents:
Just rename
<welcome-file>
entry ofindex.xhtml
toindex.jsf
and create an emptyindex.jsf
file next toindex.xhtml
to fool the container that the file actually exist.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>
ofFacesServlet
from*.jsf
to*.xhtml
.