Thanks everyone for your answers.

I think the problem may not be specifically with the expression I use; whatever 
I put in there, it always passes. I 
simplified the @Validate annotation to frame the issue and even with this it 
passes:

@Validate(expression="1 == 0")

Until recently, at least, 1 is not equal to 0 ;-)

Any idea what I could be doing wrong?

Thanks,
Math

Mathieu Avoine wrote:
> Hi,
> 
> I want to use annotation driven validation to validate that a property 
> of type List contains at least 1 item (i.e. mylist.size() > 0).
> 
> I tried using required=true, because I would have expected the behavior 
> for a List object to check for the size, but it looks like it only 
> validates if the property is not null (am I right?). So I turned to 
> expressions, and put up this one:
> 
> @ValidateNestedProperties({
> @Validate(field="selectedIds", required=true, 
> on={"goToSelectVehicles","activate"}, expression="this != null && 
> this.size > 0")
> })
> private PickList keys = null;
> 
> Unfortunately, it doesn't work. So, my questions:
> 
> 1) What am I doing wrong?
> 2) Is there an attribute for the @Validate annotation to validate the 
> size of a List?
> 
> Thanks!
> Math
> 
> 
> -------------------------------------------------------------------------
> Check out the new SourceForge.net Marketplace.
> It's the best place to buy or sell services for
> just about anything Open Source.
> http://ad.doubleclick.net/clk;164216239;13503038;w?http://sf.net/marketplace


-------------------------------------------------------------------------
Check out the new SourceForge.net Marketplace.
It's the best place to buy or sell services for
just about anything Open Source.
http://ad.doubleclick.net/clk;164216239;13503038;w?http://sf.net/marketplace
_______________________________________________
Stripes-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/stripes-users

Reply via email to