It appears that you've an existing JSF application whose FacesServlet
is mapped to *.jsf
instead of *.xhtml
and are trying to enable extensionless URLs through OmniFaces FacesViews using its default "minimal" configuration.
This will indeed not work without making other changes to the existing JSF application.
FacesViews expects that you have already mapped the FacesServlet
to the URL pattern of *.xhtml
which is recommended since JSF 2.0. So you need to make the following adjustments:
- Change
FacesServlet
mapping from *.jsf
to *.xhtml
in web.xml
.
- Find & replace all occurrences of
.jsf
throughout source code with .xhtml
. So e.g.
ec.redirect(ec.getRequestContextPath() + "/portal/employeeEdit.jsf" + "?id=" + id);
must become
ec.redirect(ec.getRequestContextPath() + "/portal/employeeEdit.xhtml" + "?id=" + id);
A bit decent IDE can do this in a few clicks (e.g. Eclipse Ctrl+H, File Search, find .jsf
in Enclosing project and replace by .xhtml
).
Alternatively, wait for OmniFaces 2.7.11 or 3.11 or 4.0-M8 to be released. I've today fixed this backwards compatibility issue in these versions as per issue 623. With this fix, the existing *.jsf
URLs will properly be automatically 301-redirected to the extensionless ones.
Note that this problem is not specifically related to URLs with parameters. It would also happen to URLs without parameters.