gpt4 book ai didi

java - JSF 中的值转换究竟发生在什么时候?

转载 作者:塔克拉玛干 更新时间:2023-11-02 19:31:57 25 4
gpt4 key购买 nike

我查阅了几个权威资料,但要么他们真的相互矛盾,要么我误解了他们,或者可能有不止一个转换发生? JSF 的 1.x 和 2.x 版本之间有区别吗?

IBM post表示转换发生在应用请求值阶段(第 2 阶段)。

post by BalusChere默认转换发生在流程验证阶段(第 3 阶段)。

Oracle JEE6 tutorial暗示转换发生在更新模型值阶段(阶段 4),在该阶段的描述中说:

If the local data cannot be converted to the types specified by the bean properties..

另一方面,说明同一教程中各个阶段的图形显示了流程验证阶段更新模型值阶段出现的转换错误。

以上所有帖子都指出,如果 immediate 属性设置为 true,则所有转换和验证都在 Apply 请求阶段 中处理。这意味着该阶段的转化不是默认行为。

谢谢

最佳答案

来自 UIInput's documentation [强调我的]:

During the Apply Request Values phase of the request processing lifecycle, the decoded value of this component, usually but not necessarily a String, must be stored - but not yet converted - using setSubmittedValue(). If the component wishes to indicate that no particular value was submitted, it can either do nothing, or set the submitted value to null.

By default, during the Process Validators phase of the request processing lifecycle, the submitted value will be converted to a typesafe object, and, if validation succeeds, stored as a local value using setValue(). However, if the immediate property is set to true, this processing will occur instead at the end of the Apply Request Values phase.

During the Render Response phase of the request processing lifecycle, conversion for output occurs as for UIOutput.There are no differences between JSF 1.x and 2.x versions.

关于java - JSF 中的值转换究竟发生在什么时候?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/12836955/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com