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

Reply via email to