JSF Lifecycle with immediate=true

1.3k views Asked by At

When I read article Listen and debug JSF lifecycle phases wrtten by @BalusC, I have some trouble understanding the article.

While Add immediate="true" to UIInput and UICommand, It says:

Note for all components with immediate: as the Update model values phase is skipped, the value bindings aren't been set and the value binding getters will return null. But the values are still available...

Note for other components without immediate: any other UIInput components inside the same form which don't have immediate="true" set will not be converted, validated nor updated, but behind the scenes the inputComponent.setSubmittedValue(submittedValue) will be executed before the action() method will be executed. You can retrieve...

Is that means no matter with or without immediate, the Update model values phase will always skipped because the immediate="true" in the h:commandButton? If so, the value in backing bean will not change, right?

However, in the last paragraph of the article, it summarized "when to use immediate=true" and mentioned:

  • If set in both UIInput and UICommand components, the apply request values phase until with update model values phases will be skipped for any of the UIInput component(s) which does not have this attribute set. Use this to skip the processing of the entire form except for certain fields (with immediate). E.g. "Password forgotten" button in a login form with a required and immediate username field and a required but non-immediate password field.

I am confused because I thought Process validations Phase and Update model values Phase are skipped no matter there are/aren't immediate once you set immdediate=true in h:commandButton in the same form.

I must misunderstood something, please help me clarify it. Thanks in advance!

1

There are 1 answers

3
BalusC On BEST ANSWER

That part indeed needs clarification.

What is meant in the summary, is the job which is normally executed in the mentioned phases (i.e. applying request values, processing validations and updating model values), even though they happen in the apply request values phase.

I have updated the article accordingly.