P: commandButton with immediate value = true

What actions are taken when I declare immediate="true" in the command button? The documentation states

Boolean value that defines the phase ID of the action event when valid actions are processed in the "Apply request values" when false in the "Call application" stage.

However, I do not understand this. Can someone explain this?

+4
source share
1 answer

The JSF life cycle contains 6 phases, which are:

  • Restore view
  • Apply query values
  • Process check
  • Update Model Values
  • Call application
  • Refuse answer

If the command button has immediate="true" , then the phases "Process Checks" and "Update Model Values" are skipped. Consequently, conversions and validations are not processed, and attributes in the managed bean are not updated.

However, if the UIInput in the form also has an immediate value = "true", then its value will be converted, checked, and updated in the managed bean, because this will happen in the "Apply Requests" phase.

One example of when you can use the button with immediate = true is the Cancel button.

+8
source

Source: https://habr.com/ru/post/1480695/


All Articles