I'm responding to my own email in order to give some feedback on how I 
solved this problem.

What I did was use the Apache commons validator package as a starting 
point.  This allowed me to specify in an xml file the forms to validate, 
which fields, and finally some number of validations to perform on each 
field.  Oh, and I could also specify the error messages.

Then, within Maverick, I called it from the beginning of perform().  The 
validator package has a feature that lets you "pass in" extra stuff.  In my 
case I pass in the errors Map -- then my validation methods were written to 
add error messages directly to the errors Map.

It ended up being pretty clean.  I think the validator package was 
originally developed with Struts in mind, but doesn't have any dependencies 
that I could see.  Validator isn't yet a released jakarta package, it 
really needs to be documented before that happens, but it is pretty good.

Dan

At 05:03 PM 3/29/02 -0800, Dan Finkelstein wrote:
>I notice that there are a few methods in Maverick for attaching error 
>messages to fields, such as addError().  These are certainly very useful, 
>_although_ I am now realizing why you have (wisely) chosen to not include 
>them in the core distribution of maverick.  It must be because the 
>messages are really part of the view and to have them embedded in the 
>controller defeats the separation.
>
>So, I'm struggling with what is the correct way to approach this 
>problem...  One idea would be to embed the messages in the velocity 
>template itself...  But that seems awkward.
>
>And, really, the error messages are caught up with the concept of 
>validation.  So maybe the idea would be to abstract out the validation and 
>error messages together.  Perhaps there could be another xml file along 
>side maverick.xml in which we specify the fields of each form, how they 
>should be validated, and text messages.
>
>I have seen that a bit of thinking has gone into this, such as Apache 
>Common's validator package.  In particular, I was wondering how you view 
>this problem.  Do you think that the MVC layer should handle 
>validation?  Or is it a separate function?  In any case, I'd be interested 
>in how you would approach this dilemma.
>
>Thanks,
>Dan
>
>
>_______________________________________________
>Mav-user mailing list
>[EMAIL PROTECTED]
>https://lists.sourceforge.net/lists/listinfo/mav-user
>


_______________________________________________
Mav-user mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/mav-user

Reply via email to