When you use /faces/* mapping to run your page through FacesServlet you should simply provide full name of your file - hello.xhtml instead of hello
When you used *.jsf mapping you had to append '.jsf' to hello to have page processed by FacesServlet.
I want to use folder-structure url in my 2nd case, i.e., no extension in the url
I find more convenient to use .xhtml extension because every my page is guaranteed to run through FacesServlet:
IF you have page with extension .xhtml and your FacesServlet is mapped to .jsf or /faces/* patterns, then user can type in browser path to your file directly
and server will return your page without running it through FacesServlet. Of course it is not possible if your page on server is inside folder 'faces' for /faces/*
When you submit a URL request to a JSF app and the URL matches one of the pattern(s) that get it routed to the FacesServlet, the FacesServlet (along with the Facelets processor) deconstruct the URL path and use it as the framework to build up a resource path. There are several built-in rulesets, the most commonly-used one being that which takes URLs ending with ".jsf" and resolves them with resources whose paths are the same as the local part of the URL path only with the ".jsf" replaced by ".xhtml".
You can modify those rules, but one easier way to be able to employ simple URLs such as "http://www.mousetech.com/nosuchapp/widget/new" or "http://www.coderanch.com/forums/posts/reply/0/597582" is to add PrettyFaces to your webapp. PrettyFaces is a JSF add-on that allows the creation of bookmarkable URLs. It's basically just a jar, a small mod to web.xml, and a config file that contains the URL mappings (these days you can also annotate backing beans). Very easy to use.
Customer surveys are for companies who didn't pay proper attention to begin with.
Joined: Oct 16, 2006
Thanks a lot for your points. They are very helpful.
subject: /faces/* url pattern and "The requested resource () is not available." error