Originally posted by Saskia de Jong:
I would say that showing ONE SINGLE url for a set of pages that forward to eachother is way better than showing the WRONG page. Showing the wrong page is very confusing for users, let alone a true support nightmare.
I've stumbled upon the same problem. My initial solution to this problem is to create a custom view-handler. This view handler doesn't use the requested URL to restore the view, but uses a supplied parameter. If you alter the form in each JSF page to post to a single URL, then you essentially have what is asked above.
A quick and dirty implementation would look like this:
ViewHandlerDecorator is a straighforward class that just wraps the previous installed viewhandler and by default passes everything to this embedded handler:
In your set of JSF pages do something like this:
(remove the _ in the on_click attribute)
For completeness, an additional viewhandler can be installed by putting the following in faces-config.xml:
I've tested this using Myfaces 1.1.1 on Tomcat 5.5.17 with statesaving set to client and everything seems to work. Note that I'm depending on the MyFaces specific parameter "jsf_viewid", so for a more generic method you'll have to do some extra work. As said, the code given above is just a quick and dirty implementation of the idea, but it does show how flexible JSF really is.