> Using either customized Java code or regular expressions, a > developer can ensure that any incoming form data is legal and valid. > This is a tremendous help to any developer as it prevents bad > data from being processed by their Action and, many times, > causing the user to see annoying 500 errors.
I'm not sure why any Action would bomb out from invalid data. If that happens, IMO, you're putting too much logic in your Action. IMO, data validation belongs at the BO level. No matter where your data comes from, your BO should decide for itself whether or not it's valid before it tries to process it. It shouldn't just assume that it will get valid data. For this reason, in one project I completed, we ignored client-side validation nearly completely, and instead relied on server-side validation coming from the BO's themselves. This way, no matter what screen tried to do what operation, correct error messages would be given back to the user and the screen would re-paint. This was a lot easier and more logical to me than having each screen (which is simply a view to data) know exactly what kind of data is valid for what it is displaying. Doing it at the BO level, if there is a change in one validation, it gets changed in one place, no matter how many screens can updated that piece of data. Much easier, IMO. So, I'd like the Validator framework to work at the BO level and the javascript/screen level, and skip the Action level altogether. I prefer my Actions to be really, really stupid - traffic-controllers only, not data handlers. Matt Kruse