JSF: why is empty test in rendered invoked during apply request values phase during form submission under request scoped POST REDIRECT GET

核能气质少年 提交于 2019-12-06 09:39:34

The reason that the rendered attribute is consulted twice or more after a post back is because JSF traverses the component tree in each phase.

The name 'rendered' is perhaps not the best possible name, as it doesn't just make rendering of the component to which it applies conditional, but actually processing it in general.

It's consulted in the first place for 'apply request values' to see if that component and its children should be processed to have those request values applied to them. It's consulted again in 'process validations', since its value might have changed between phases.

It's not invoked 'during those phases when I perform an initial GET load', because when you perform a GET the component tree isn't traversed in those phases (only the metadata is processed, which is the reason view params are put in a special metadata section).

In order to make the id that you received from the GET request available in the action method after the post back, you'd best use the view scope (@ViewScoped) for your backing bean.

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