myfaces-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Gerald Turner <gtur...@unzane.com>
Subject Re: ExtVal BV question
Date Thu, 08 Mar 2012 19:50:29 GMT
Rudy De Busscher <rdebusscher@gmail.com> writes:
> first, welcome to the mailing list.

Thanks!

> a) about the multifield ConstraintValidator.
> You see the messages twice since you set 2 ConstraintViolation on the
> context.  And to my knowledge there is no link between the
> propertyPath and the component the message is intended to.  Not in the
> JSR303 and thus not in the ExtVal support for it.  Can you please
> point us to the info (spec) if we are wrong.

In JSR303 § 4.2 ConstraintViolation, there is the following note:

  “From rootBean and propertyPath, it is possible to rebuild the
   context of the failure”

The chapter continues with several examples of these Node/Path objects.

Unfortunately the specification doesn't make any further statements
about how JSF or any other toolkits *should* infer what components are
in violation, but the spec is framework agnostic afterall…

> b) Validation in 2 phases
> This is due to the fact that you need all the field values in the
> model before you can do any multifield validation.
>
> Within the Process Validation phase, the JSF validations on a single
> field takes place (required, within limits, etc ...). ExtVal then also
> processes the BeanValidation annotations which are placed on the
> field/method like @Size, @NotNull etc ...
>
> But the multi field validation can't be performed at that moment
> because it requires that the screen values are propagated to the
> managedBean.  This is because the ConstraintValidator needs the object
> populated with the values to do his checks.  This means it can be only
> done after the 'update model values' phase and thus only performed
> when no problems are found yet.
>
> Hopes this clarifies the things a bit.

Yes this makes sense, I just wanted to clarify I wasn't doing something
wrong, missing configuration, etc.  I think it is acceptible for the
user interface that the more complex validations happen in a second
pass.

-- 
Gerald Turner   Email: gturner@unzane.com   JID: gturner@unzane.com
GPG: 0xFA8CD6D5  21D9 B2E8 7FE7 F19E 5F7D  4D0C 3FA0 810F FA8C D6D5

Mime
View raw message