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 (see all)
- Primavera Error: The database is not setup to use the authentication mode selected: WebSSO:LDAP - June 22, 2017
- Primavera P6 professional Login alert box:The database has not been configured to run background jobs. To correct this error contact your system administrator - June 22, 2017
- How to integrate Oracle BI Publisher and LDAP in WebLogic server - June 21, 2017