I second that. I'm using this technique myself as well. Extending the
validation provider is quite easy and allows such "nested" validation
informations retrieval.

An example :
http://minilien.com/?bXxmDM7fR7

This basically fetches Stripes validation annotations from a property
of an action bean. It's specific and tailored to our needs, but the
idea is there, and with a little reflection I bet you'll do what you
want quite easy. The big issue is to get a ref to the action bean
(hence the interceptor / thread local thing)

Btw, a NestedValidationMetadataProvider ootb in Stripes would be quite
cool actually... maybe we could add this in StripesStuff ?

Cheers

Remi

2009/6/17 Mike McNally <[email protected]>:
> I've been able to extend the default Strips ValidationMetadataProvider
> to make it possible to "pull" validation information up from
> referenced classes. In fact that was basically the first thing I did
> after I started using Stripes, because it seems like such an obvious
> thing.  Now, an action can reference an object (in your example,
> something like a date range object) and pull validation info from
> that.  Due to the facilities already in the framework it really wasn't
> that hard, and I don't have much experience with that specific sort of
> thing.
>
> So with that, you'd annotate your class (not an action bean - the
> "date range" class), and then your action beans would all just have an
> instance of that. Thanks to the way the bean populator works, your
> action beans will get nicely populated objects, but only after they
> validate.
>
> Honestly I can't imagine using Stripes for a project of any magnitude
> without our facility that does this.  Oh, another nice thing it does
> is to check JPA annotations too so that your JPA "length" can be used
> for the Stripes validation "maxlength".  Now all our validation
> annotations are centralized, and (for example) something that has to
> present a password field that needs to conform to one in a particular
> object can just annotate with "@ValidateFrom(beanclass="whatever",
> property="password")".  If the basic password details change (longer
> maybe, or content rules change, then that automatically propagates to
> all the actions that reference it.
>
>
> --
> Turtle, turtle, on the ground,
> Pink and shiny, turn around.
>
> ------------------------------------------------------------------------------
> Crystal Reports - New Free Runtime and 30 Day Trial
> Check out the new simplified licensing option that enables unlimited
> royalty-free distribution of the report engine for externally facing
> server and web deployment.
> http://p.sf.net/sfu/businessobjects
> _______________________________________________
> Stripes-users mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/stripes-users
>

------------------------------------------------------------------------------
Crystal Reports - New Free Runtime and 30 Day Trial
Check out the new simplified licensing option that enables unlimited
royalty-free distribution of the report engine for externally facing 
server and web deployment.
http://p.sf.net/sfu/businessobjects
_______________________________________________
Stripes-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/stripes-users

Reply via email to