<f:ajax event="change" render=":moons :suns" />
<a4j:support event="onchange" reRender=":moons, :suns" />
<p:ajax event="change" update=":moons, :suns" />
1. Note those three ajax calls. The first one is a standard JSF ajax
that belongs to java.sun.com/jsf/core
it uses renders
attribute to update the required components in DOM.
render - A space-separated list of IDs for components that will be updated after an Ajax request. (only spaces are valid)
2. The second one belongs to RichFaces 3, note the difference on event
attribute
reRender - attribute that defines id(s) of JSF component(s) that should be rerendered after an Ajax request. ... It's also possible to use JSF EL expression as a value of the reRender attribute. It might be a property of types Set, Collection, Array or simple String. (commas are valid, not sure about spaces)
- in RichFaces 4 the
reRender
attribute has been renamed to render
3. The third one belongs to PrimeFaces and uses an update
attribute (in my opinion the most meaningful name of those three)
update - Component(s) to update with ajax. (spaces and commas are valid)
So as you can see they basically do the same job with minor differences in how to use them. No, You can't mix them. Use render
with jsf/core, reRender
with ajax4Jsf in Richfaces 3, and update
with PrimeFaces components. Note that in RichFaces 4 the reRender
attribute has been renamed to render
.
What concerns events - PrimeFaces and jsf/core use actual DOM-event names (unprefixed), RichFaces on the other hand uses prefixed events eg. onchange
as opposed to change
. Note that the new RichFaces 4(<a4j:ajax>
replaced <a4j:support>
) <a4j:ajax>
's event
attribute works the same as <f:ajax>
's event
.
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…