OCPSoft.com - Simple SolutionsCommunity Documentation
While compatible with any Servlet 2.5+ container, some features are only available in JavaServer Faces.
Sections describing these features are marked with a '*'. This means that the feature either requires JSF, or requires an environment that has configured JSF in order to function; otherwise, those marked features will not be available.
PrettyFaces is an OpenSource extension for Servlet, Java EE, and JSF, which enables creation of bookmarkable, REST-ful, "pretty" URLs. PrettyFaces solves several problems elegantly, such as: custom URL-rewriting, page-load actions, seamless integration with JSF navigation and links, dynamic view-id assignment, managed parameter parsing, and configuration-free compatibility with other JSF frameworks.
Any business knows how important Search Engine Optimization can be for sales. PrettyFaces allows SEO-friendly URLs, and improved customer experience. Give your site a uniform, well understood feeling, from the address bar to the buy button.
What is sometimes neglected, even when building web-sites that aren't for external customers, is the consistency of the URL displayed to users in the browser address bar. Keeping the URL tidy can make a big difference in usability, providing that smooth web-browsing experience.
Example 1.1. A URL rewritten using PrettyFaces
Consider the following URL.
http://ocpsoft.com/index.jsf?post=docs&category=prettyfaces
When presenting information to users (frequently your clients,) it is generally bad practice to show more information than necessary; by hiding parameter names, we are able to clean up the URL. The following URL-mapping accomplishes our goal:
<url-mapping> <pattern value="/#{post}/#{category}" /> <view-id>/index.jsf</view-id> </url-mapping>
Our final result looks like this:
http://ocpsoft.com/docs/prettyfaces/
This is just a simple example of the many features PrettyFaces provides to standardize your URLs
Notice that outbound links encoded using
HttpServletResponse.encodeRedirectURL(url)
will also be automatically rewritten to new URLs,
unless disabled by using the outbound="false"
attribute on a given URL-mapping configuration.