Understanding the JSF Immediate Attribute

As, i am working on my project.I have to use cancel button.So somebody said make immediate attribute to true.There is very common myth among ADF and JSF developers that using Immediate attribute will avoid unnecessary validation in any case. It is not 100% correct. Basically , everyone not very much clear about it. If we don’t use correctly , application can work randomly.Let discuss more about it to have better understanding.

In ADF application we have either

1. input component
2. Command component

You can use the immediate attribute to allow components on the page to be validated in the Apply Request Values phase of the life cycle as opposed to the Process Validations phase:

•Input component- Using immediate on an means that that component’s value is validated before any input components that do not have the immediate attribute set to true. Therefore, if a validation error occurs on an immediate input component, the life cycle moves from the Apply Request Values phase (where the immediate attribute is evaluated) to the render phase, and validation does not run on any “nonimmediate” input components. Additionally, if the new value of an immediate input component is different from the existing value, then a ValueChangeEvent is raised. However, instead of the event being processed during the Process Validations phase, the event is processed at the end of the Apply Request Values phase. Therefore, any ValueChangeListener associated with the immediate input component executes before any command component’s ActionListener (assuming the command component occurs later on the page).


• Command Components-
if set to immediate and the component has an action that
returns a value for navigation, the life cycle proceeds directly to the Render Response
phase. The validation and model update phases are skipped. A Cancel button is an example of when this would be used