Question

I integrated Tuckey UrlRewrite filter in my JSF application. My URLs now look like:

http://localhost:8080/myapp/page

instead of

http://localhost:8080/myapp/faces/page.xhtml

The problem is that my JSF forms submits to the old url

http://localhost:8080/myapp/faces/page.xhtml

and I am getting a FacesFileNotFoundException.

How can I solve this issue?

Was it helpful?

Solution

You've to implement a custom ViewHandler and override the getActionURL() method to return the desired form action URL. That's where the forms get its action URL from. This is by the way also what PrettyFaces, the JSF URL rewrite solution, does. You may want to use it instead of reinventing the same wheel. It's by the way open source, so you could just peek around in its source code to see how they did it.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top