JSF 2 now has basic Ajax support via f:ajax tag. RichFaces 3 has a very popular a4j:support tag (in fact, f:ajax was inspired by a4j:support). RichFaces 4 comes with a4j:ajax which is based on f:ajax but upgrades the tag with more features and advanced functionality. The table below show the attributes available in both tags and how RichFaces upgrades the core Ajax functionality in JSF 2 (I’ll cover a4j:ajax extra attributes in the future).
In addition to a4j:ajax, RichFaces upgrades JSF 2 with tags such as a4j:commandButton, a4j:commandLink, a4j:poll, a4j:jsFunction, a4j:outputPanel and more (covered in future posts).
Attribute | f:ajax | a4j:ajax |
---|---|---|
event | Works the same | Works the same |
execute | @all @this @form @none Id’s EL |
@all @this @form @none Id’s EL (different behavior, id’s are resolved in current request) @region (when a4j:region is used) |
render | @all @this @form @none Id’s EL |
@all @this @form @none Id’s EL (different behavior, id’s are resolved in current request) |
listener | Works the same | Works the same |
onevent | Works the same | Works the same |
onerror | Works the same | Works the same |
immediate | Works the same | Works the same |
disabled | Works the same | Works the same |
onbegin | n/a | JavaScript to execute before Ajax request |
onbeforedomupdate | n/a | JavaScript to execute after response comes back but before DOM update |
oncomplete | n/a | JavaScript to execute after DOM update |
bypassUpdates | n/a | Skips Update Model and Invoke Application phases, useful for form validation |
limitRender | n/a | Skips all a4j:outputPanel ajaxRender=”true” areas. Only renders what is set in current render |
status | n/a | Status to display during Ajax request |
focus | n/a | Sets focus on component after Ajax request (not yet implemented) |
Leave a Reply