4 total views, 1 views today
Rewrite JSF 2.0 URL using PrettyFaces
Pretty Faces is an open source solution to rewrite URL in JSF and J2EE frameworks. It makes the URL pretty and SEO-friendly. As an example, We could replace our JSF URLs from /faces/* to /* in 2 minutes. In this section, we have mentioned how to rewrite URL in JSF using Pretty Faces
Old URL: http://localhost:9090/catgovind/faces/index.xhtml
New URL: http://localhost:9090/catgovind/index
Add the prettyfaces-jsf2-3.3.3.jar file into your <project>\WEB-INF\lib folder.
Create pretty-config.xml under your <Project>\WEB-INF folder. The final Project structure will look like below
Edit the pretty-config.xml and add URL-mapping point to your xhtml file as shown below.
<pattern value="/index" />
<view-id value="/faces/index.xhtml" />
Test it in browser
Download Source Code: JSF URL rewritten in Pretty Faces
The views expressed on this blog are my personal views and do not necessarily reflect the views of my employer.
Please feeling free to reach me on any comments and feedbacks you have. Would be more than glad to listen and reply 🙂
Latest posts by Govind
- JSF Login Logout Form Authentication Example - October 16, 2017
- How to Bookmark URL in JSF using GET method and ViewParam – example - October 14, 2017
- JSF Dynamic Navigation and how to use wildcard in navigation - October 12, 2017