Hi all!
I was wondering : is it possible to do nested validation to more than one level?
Lets say I want to validate the name of an Account contained in a WebModel,
for instance : getWebModel().getAccount().getName()
I know the annotation @ValidateNestedProperties makes it possible to
validate
Hi Samuel,
Apparently, you're right : @ValidateNestedProperties references @Validate,
not @ValidateNestedProperties again...
If this can help you, I have a workaround. I'm using a custom
NestedValidationMetadataProvider in Woko, that allows you to write
validation annotations inside your POJOs,
Hi Remi
and thanks for your answer!
I can see I'm not the only that faced that problem!
Like you said, that forces the dev to think about the validation
outside the ActionBean...
Wouldn't that be a problem if you only want to validate on one of them
and not others?
I was in the source code of
Hi again,
Yes for sure, if you want to keep the validation on the bean class, the
immediate option would probably be :
@ValidateMetadataProperties([
@Validate(field=foo, ..),
@ValidateNestedProperties([
@Validate(field=bar)
])
)]
It doesn't seem possible to achieve this currently
Properties can be nested as deeply as you need them to be. Nested field
names are separated by dots. For your example, you'd use:
@ValidateNestedProperties(@Validate(field=*account.name*, ...))
private WebModel webModel;
-Ben
On Thu, Mar 10, 2011 at 5:48 AM, samuel baudouin
Remi, thanks for those precisions!
But it seems like Stripes beats us again!
Ben, thanks for that!
Sometimes the most obvious is not what we think about in the first place!
Cheers all,
Sam
On Thu, Mar 10, 2011 at 9:36 PM, Ben Gunter gunter...@gmail.com wrote:
Properties can be nested as
Even easier :)
Still, doesn't address the dynamic aspect of the problem.
Cheers
Remi
2011/3/10 samuel baudouin osenseij...@gmail.com
Remi, thanks for those precisions!
But it seems like Stripes beats us again!
Ben, thanks for that!
Sometimes the most obvious is not what we think about in