New releases, and changes coming in PrettyFaces
PrettyFaces – SEO, Dynamic Parameters, Bookmarks, and Navigation for JSF / JSF2 version 2.0.3 offers a BIG new feature for URL validation, while 1.2.6 is a maintenance release, primarily adding the <p:link anchor=”…”> attribute – it does not include the new validation features.
Coinciding with the JSF2.0 release, OcpSoft will be updating PF1.2.x for maintenance only, however, community participation is still welcome on all versions of the project.
You can now become powered-by-prettyfaces, or have your prettyfaces-powered site listed to build additional SEO page-rank. We want to know who is using our tool!
Note: There is one additional change in both 2.0.3 and 1.2.6 that people should be aware of. PrettyFaces will be making a shift in underlying architecture to take advantage of more advanced features in JSF2. Going forward, Pretty <action> methods will no longer be called BEFORE RESTORE_VIEW phase, but will be called AFTER RESTORE_VIEW phase by default. Dynamic View-ID functionality should be considered deprecated, but don’t worry, there will be an equivalent provided.
While it could potentially impact some applications functional behavior, the change is necessary in order to make progress and enable cool new features now and in the future! So, apologies for any trouble, but we’re sure that you’ll like what’s coming!
Big new feature in 2.0.3_RC1:
Integrated URL validation – Everyone should be afraid of user input, and parsing values from the URL is no different. But be not afraid! It is now possible to attach JSF validators to URL and Query parameters. This functionality parallels the new <f:pageParam> tag provided in JSF2, but also provides additional hooks into Validation error handling.
<url-mapping id="validate"> <pattern value="/validate/#{validationBean.pathInput}"> <validate param="0" validatorIds="validator1 validator2" onError="#{validationBean.handle}" /> </pattern> <query-param name="param1" validatorIds="validator2" onError="pretty:demo"> #{validationBean.queryInput} </query-param> <view-id>/faces/validation/test.jsf</view-id> </url-mapping> |
As you can see, path parameters may now be validated with the <validate> element, and query parameters have a new “validatorIds” attribute. Any number of validatorIds may be attached to a given parameter. If validation fails, the system will send a 404 – Page Not Found response to the client.
If the default validation error handling is not enough, each validation may be provided with an optional “onError” attribute, which can be a “pretty:mappingId” (which issues a redirect to the page specified), or a #{jsfBean.handlerMethod} to allow complete control of the validation error. If the handler method returns null, or empty, the error is ignored and the lifecycle will continue. If the handler method returns a pretty:mappingId, PrettyFaces navigation will be invoked.

PrettyFaces Validation Flow
May the power of pretty be with you.
Posted in Releases
Very nice lincoln! I will blog about this too!
Greetings,
Dominik
How do I validate URL parameters in PrettyFaces 1.2.6_RC1? Thanks in advance.
Integrated validation is only available in the 2.0.x series. Sorry, Bjorn. We’re phasing out enhancements to the 1.x series with the recent release of JSF2.
As a workaround, I recommend doing validation in a prettyfaces action method.
How can I build pretty urls in trinidad iterator or
Any help will be good.
thanks!
Since Trinidad is a component, I’m not sure what you are asking. PrettyFaces defines behavior that occurs before view files are encountered, so iterator should not interfere at all with PrettyFaces. Also, if you could please post your next question to the users-group, we can answer your question for everyone there 🙂 thanks! Lincoln
( http://groups.google.com/group/prettyfaces-users )
Hi,
I wanna display a list of product in my online store. To displaying products in jsf form i’m using data table or iterator component. So I do not know how to create pretty link for them 🙂
Thx Kris
Just use pretty:link and pass in f:param value=”#{row.value}” like you would in any other link.