-
1. Re: 2 Phase Validation Scenario
stephen May 26, 2008 8:47 PM (in response to graben)
1. Phase: In the first phase the hibernate validatorsThat's not quite correct. All validators are checked in that phase.
You can execute your own validations in that phase, too.
See sections 10 and 29.2 in the latest version of the seam reference. (And google for jsf validation.) -
2. Re: 2 Phase Validation Scenario
graben May 26, 2008 9:08 PM (in response to graben)Well, that's not really what I mean. Sometimes you need the content of several fields to check for some rules. So I can't use @Validator which is meant for single fields only.
-
3. Re: 2 Phase Validation Scenario
stephen May 26, 2008 11:09 PM (in response to graben)Ah I see. Yes, validation of interdependent fields is a weak point of JSF.
Still, I think you should use a JSF validator.
A common way to do this is to attach the validator to the last component. Inside the validator find the other fields by looking them up from the component tree, then use their local values.
(Or use binding to get access to the other components, but be aware that you can't bind jsf components to a seam component in conversation scope.)(Or use an artificial hidden field with a fixed value and access all fields you need to validate by using the component tree/binding.)
Core Java Server Faces
has a nice section on this.