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
- P6 Progress Reporter completely integrated into P6 Team Member - August 15, 2017
- Primavera P6 Professional for EPPM Popup 16.2 : The appropriate industry for your organization has not yet been select in admin preferences - August 15, 2017
- Primavera P6 Background Job Error:Creating job Symon Failed to add Database Job, Check the settings table for valid interval values for dbms_scheduler - August 14, 2017