I have a simple JSF2 app using Facelets. My web.xml is set as follows:-
<servlet-mapping>
<servlet-name>Faces Servlet</servlet-name>
<url-pattern>*.jsf</url-pattern>
</servlet-mapping>
I want to set the app to default to the welcome page which is /pages/login.xhtml. I can't seem to get the welcome-file setting to pick up this when going to the context root in the browser.
My web.xml welcome setting is as follows:-
<welcome-file-list>
<welcome-file>/pages/login.jsf</welcome-file>
</welcome-file-list>
How do I force the welcome-page to goto the login page and ensure it goes through the faces servlet?
If I use the following the page displays but it hasn't gone through the faces servlet and so faces components aren't rendered:-
<welcome-file-list>
<welcome-file>pages/login.xhtml</welcome-file>
</welcome-file-list>
Any help appreciated!
You have to create an empty login.jsf file, adjacent to your login.xhtml file. For some reason this hack is needed to trick the servlet container into thinking your welcome file exists.
Note: The response served will still be the JSF response using your login.xhtml file, not the empty login.jsf file you create.