Validation in bP framework - issue with "New" Dispatch

Rick Reumann <[email protected]> Tue, 10 Jun 2003 00:30:58 -0400
Newsgroups gmane.comp.java.mvc.devel
Organization baseBeans Engineering
Message-ID <[email protected]>
I waited to the end to add some validation stuff to my project which is 
following the BaseBeans framework. The BaseBeans approach likes to use one 
Dispatch action as much as possible for related tasks (which I like to as 
well). The problem is with the "New" Dispatch. Now I remember why in my 
apps I usually have a separate setUpAction for dealing with the "New" 
population of a form. The problem is that if BaseBean is going to extend 
ValidatorForm (and not ValidatorActionForm), you will run into problems if 
your intial form has invalid initial properties that don't match validation 
since the associated formBean will be validated if validation is set to 
true. The way I like to get around this is to have a separate action 
mapping with validation set to false for going to the form for an initial 
entry ("Dispatch=New"). Of course this means you have to have an extra 
Action mapping for all your forms in the struts config file. If you don't 
like this approach another option which "might" work is to have BaseBean 
extend ValidatorActionForm but this will force all your validations to map 
to particular actions (vs being tied to the form beans) which I think will 
cause a lot of redundant stuff in the validation.xml file. Plus I'm not 
sure how it works with Dispatch paramaters (I assume it would work but 
haven't tried).

-- 
Rick