p:commandButton具有即时= true [英] p:commandButton with immediate=true
问题描述
当我在命令按钮中声明immediate="true"
时会采取什么措施?文档说
What action is taken when I declare immediate="true"
in command button? The documentation says
确定操作事件的phaseId的布尔值,当在应用请求值"处处理为真动作时,在调用应用程序"阶段为false时.
Boolean value that determines the phaseId of the action event, when true actions are processed at "Apply Request Values", when false at "Invoke Application" phase.
但是,我不明白.有人可以解释一下吗?
However, I don't understand it. Can someone please explain this?
推荐答案
JSF生命周期包含6个阶段,分别是:
JSF lifecycle contains 6 phases, which are:
- 还原视图
- 应用请求值
- 过程验证
- 更新模型值
- 调用应用程序
- 渲染响应
如果命令按钮具有immediate="true"
,则将跳过过程验证"和更新模型值"阶段.因此,不会处理转换和验证,并且不会更新托管Bean中的属性.
If a command button has immediate="true"
, then the phases 'Process validations' and 'Update model values' are skipped. Therefore, convertions and validations are not processed and attributes in managed bean are not updated.
但是,如果表单中的UIInput也具有Instant ="true",则其值将在托管Bean中进行转换,验证和更新,因为它将发生在应用请求值"阶段.
However, if a UIInput in the form also has immediate="true", then its value will be converted, validated and updated in managed bean, because it will happen in 'Apply request values' phase.
取消"按钮的情况是您何时可以使用带有即时="true"按钮的一个示例.
One example of when you might use a button with immediate="true" is the case of a 'Cancel' button.
这篇关于p:commandButton具有即时= true的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!