Validate class level bean validation constraints in JSF

后端 未结 1 1420
死守一世寂寞
死守一世寂寞 2020-11-30 15:16

It seems that JSF 2.0 does not call "class level constraints". Quoting from an SO answer

JSF 2.0 doesn\'t call class level validation constrain

相关标签:
1条回答
  • 2020-11-30 16:17

    Until the upcoming JSF 2.3, JSF doesn't support class level validation using a.o. @Valid. This is an eternal issue, given that the very first JSF spec issue ever addresses this.

    Your resort is either using a 3rd party library which has already taken care of it, or homebrewing it based on sources of the open source library in question (taking licensing into account).

    Apart from SeamFaces <s:validateForm> which you already found, there's also OmniFaces <o:validateBean>. The major difference as compared to <s:validateForm> is that it doesn't use a JSF Validator, but a JSR303 ConstraintValidator (and that you've the whole entity immediately at hands without the need to declare and annotate a bunch of fields, repeating the entity's properties.

    JSF 2.3 support will come in flavor of <f:validateWholeBean> which is largely based on OmniFaces <o:validateBean>.

    0 讨论(0)
提交回复
热议问题