I\'m developing a JSF 2 web application. For prestige purpouses I would like that every URL ends with .jsf extension. Now it ends with .xhtml. If I
The URL pattern of JSF pages is specified by of the FacesServlet in web.xml. As you mentioned that .xhtml works fine, you have apparently configured it as follows:
Faces Servlet
javax.faces.webapp.FacesServlet
Faces Servlet
*.xhtml
You need to change the accordingly to get the desired virtual URL extension.
Faces Servlet
javax.faces.webapp.FacesServlet
Faces Servlet
*.jsf
That's all you need to change in order to achieve the concrete functional requirement, really.
However, this puts a security problem open. The enduser can now see the raw Facelets file source code when changing the extension in the URL back from .jsf to .xhtml. You can prevent this by adding the following security constraint to web.xml:
Restrict access to Facelets source code.
Facelets
*.xhtml