ConstraintViolationInterceptor adds constraint violations from the ActionContext to the Action's field errors.
This interceptor adds any error found in the {@link ActionContext}'s constraint violations map as a field error (provided that the action implements {@link ValidationAware}). In addition, any field that contains a constraint violation has its original value saved such that any subsequent requests for that value return the original value rather than the value in the action. This is important because if the value "abc" is submitted and can't be set on a property requiring at least 5 characters, we want to display the original string ("abc") again rather than the original value (likely an empty string, which would make very little sense to the user).
This is similar, in principle, to the XWork ConversionErrorInterceptor and much of the code is reflects that.
|
|
|
|
|
|
|
|
|
|