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

Download Required:

Download prettyfaces-jsf2-3.3.3.jar

Step-1:

Add the prettyfaces-jsf2-3.3.3.jar file into your <project>\WEB-INF\lib folder.

Step-2:

Create pretty-config.xml under your <Project>\WEB-INF folder. The final Project structure will look like below

022816_2109_Howtorewrit1 How to rewrite URL in JSF using PrettyFaces?

Step-3:

Edit the pretty-config.xml and add URL-mapping point to your xhtml file as shown below.

 

Step-4:

Test it in browser

022816_2109_Howtorewrit2 How to rewrite URL in JSF using PrettyFaces?

 

Download Source Code: JSF URL  rewritten in Pretty Faces

govindan How to rewrite URL in JSF using PrettyFaces?
Connect me

Govind

Thank you for visiting my personal blog. Myself Govindan, Software Developer by profession since 2006 and hence I started this blog early in 2016 and ever since I've been writing about technologies experienced and learnings of everyday life.

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 šŸ™‚
govindan How to rewrite URL in JSF using PrettyFaces?
Connect me
By | 2017-06-08T22:47:32+00:00 February 28th, 2016|Categories: JSF|Tags: |0 Comments
Like us on Facebook.
Connect!