Mapping JSF .xhtml files to no extension
That's not possible using the standard means. You basically need to homebrew a servlet filter which is mapped on /*
and checks if the current request URL is an extensionless one and if so, then perform a RequestDispatcher#forward()
call on the URL with the file extension appended (you know, a forward does not modify the current request URL as a redirect would do). You also need a custom view handler to produce the desired extensionless URLs for JSF <h:form>
, <h:link>
, etc.
Alternatively, you can use PrettyFaces or OmniFaces' FacesViews so that you don't need to reinvent the wheel. At the bottom of the FacesViews showcase page you can find some easy links directly to the source code which may give you some inspiration.