JSF Lifecycle with immediate=true

拥有回忆 提交于 2019-12-11 01:05:48

问题


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:


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.



来源:https://stackoverflow.com/questions/20515113/jsf-lifecycle-with-immediate-true

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!