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
- Is it possible to logout Primavera P6 through SQL Query? - February 16, 2018
- How to Create Primavera P6 EPPM Database schemas in Microsoft SQL Server - February 15, 2018
- Configure Windows Firewall for Microsoft SQL Server 2017 – Part 4 - February 14, 2018