How do I configure JSF url mappings without file extensions?
you can create url mapping like this create faces-config.xml file in WEB-INF folder
<?xml version="1.0" encoding="ISO-8859-1"?>
<faces-config xmlns="http://java.sun.com/xml/ns/javaee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/javaee
http://java.sun.com/xml/ns/javaee/web-facesconfig_1_2.xsd"
version="1.2">
<navigation-rule>
<from-view-id>/jsf/demoapp</from-view-id>
<navigation-case>
<from-outcome>demoapp</from-outcome>
<to-view-id>/demoapp.xhtml</to-view-id>
</navigation-case>
</navigation-rule>
</faces-config>
in web.xml you have to do 2 entries
<servlet>
<servlet-name>jsfServlets</servlet-name>
<servlet-class>javax.faces.webapp.FacesServlet</servlet-class>
<load-on-startup>1</load-on-startup>
</servlet>
<servlet-mapping>
<servlet-name>jsfServlets</servlet-name>
<url-pattern>/jsf/*</url-pattern>
</servlet-mapping>
You can use Filter to hide this extension and make your URL SEO friendly. One such implementation of Filter is PrettyFaces.
For example:
If you need http://host:port/yourapp/login
to resolve with your login.xhtml
then in pretty filter configure following way
<url-mapping id="login">
<pattern> /login </pattern>
<view-id> /legacy/user/login.jsf </view-id>
</url-mapping>
Have a look at two min video tutorial