I am trying to implement partial validation in Spring Webflow 2.4. According to their reference manual the validation should be done very simply using groups:
@NotNull
@Size(min = 2, max = 30, groups = State1.class)
private String name;
In my understanding the State1 should be the ID of view-state in which the model should be validated. So the definition of this view state in flow.xml would look like this:
<view-state id="state1" model="modelObject"/>
I was trying to define the State1 as an inner class of my model object, but without success.
The Webflow reference doesn't provide full manual for partial validation, so my question is: Am I missing something? Does anybody have experience with using the partial validation using JSR303 groups?
Thanks, Shimon
"In my understanding the State1 should be the ID of view-state in which the model should be validated."
Here groups is not referring to view-state id. It is an inner class or parent or interface implemented by model object.
To realize JSR-303 partial validations, in SWF 2.4 onwards(this is the version SWF starts supporting it), you need to specify validation-hints as:
where group1, group2 can be inner Class either in the model type modelObject or its parent types or interfaces implemented by modelObject.
As per the documentation here:
I think I can answer my own question now :)
The root of the problem was in 2 things:
The Group1 should be an inner interface of model object. So the model object class should look something like this:
the name od validation-hint should be in single quotes