Difference between UIInput#getValue() and getLocalValue() during validation

前端 未结 1 1713
执笔经年
执笔经年 2020-12-16 22:35

I would like to have an illustrative explanation about the difference between getValue() and getLocalValue() methods of UIInput components in the a

相关标签:
1条回答
  • 2020-12-16 23:16

    If the UIInput component has been validated beforehand and is marked invalid (i.e. isValid() method returns false), then the getLocalValue() returns null, but the getValue() returns the old model value, if any. If it's marked valid, then both returns the same value, namely the submitted, converted and validated value.

    You'd like to add a check on isValid() beforehand. You may find the source code examples of the OmniFaces multiple field validators helpful. See the ValidateMultipleFields source code link at the bottom of the <o:validateEqual> showcase page.

    See also:

    • JSF doesn't support cross-field validation, is there a workaround?
    0 讨论(0)
提交回复
热议问题