What exactly are process
and update
in PrimeFaces p:commandXxx
components and execute
and render
in f:ajax
tag?
Which works at the time of validation? What does update
attribute do rather than updating value to component from back end? Do process
attribute bind value to model? What exactly do @this
, @parent
, @all
and @form
in both attributes?
The example below is working fine, but I am a little confused in basic concepts.
<p:commandButton process="@parent"
update="@form"
action="#{bean.submit}"
value="Submit" />
This question is related to
jsf
primefaces
process
updates
If you have a hard time remembering the default values (I know I have...) here's a short extract from BalusC's answer:
Component | Submit | Refresh ------------ | --------------- | -------------- f:ajax | execute="@this" | render="@none" p:ajax | process="@this" | update="@none" p:commandXXX | process="@form" | update="@none"
Please note that PrimeFaces supports the standard JSF 2.0+ keywords:
@this
Current component.@all
Whole view.@form
Closest ancestor form of current component.@none
No component.and the standard JSF 2.3+ keywords:
@child(n)
nth child.@composite
Closest composite component ancestor.@id(id)
Used to search components by their id ignoring the component tree structure and naming containers.@namingcontainer
Closest ancestor naming container of current component.@parent
Parent of the current component.@previous
Previous sibling.@next
Next sibling.@root
UIViewRoot instance of the view, can be used to start searching from the root instead the current component.But, it also comes with some PrimeFaces specific keywords:
@row(n)
nth row.@widgetVar(name)
Component with given widgetVar.And you can even use something called "PrimeFaces Selectors" which allows you to use jQuery Selector API. For example to process all inputs in a element with the CSS class myClass
:
process="@(.myClass :input)"
See:
By process (in the JSF specification it's called execute) you tell JSF to limit the processing to component that are specified every thing else is just ignored.
update indicates which element will be updated when the server respond back to you request.
@all : Every component is processed/rendered.
@this: The requesting component with the execute attribute is processed/rendered.
@form : The form that contains the requesting component is processed/rendered.
@parent: The parent that contains the requesting component is processed/rendered.
With Primefaces you can even use JQuery selectors, check out this blog: http://blog.primefaces.org/?p=1867
Source: Stackoverflow.com