This was previously discussed in the "Validation" thread back in November, but I never really "got it". This list has several new members so I would be interested in hearing new solutions, not that I discount the "elder's" opinions. ;-)
I have a web-based form and I need to persist the data in a database. I also want to validate the data and, if there are errors, reload the form and display the errors to the user. (The form is self-posting to make it easier to re-populate the fields with just-submitted data.) I also have a simple bean that contains only getters and setters that equate to the form fields. The setters are all "typed" (e.g. String, Numberic, etc.) according to the requirements. (This is the data that needs to be validated, eventually, before saving to a database.) I have a DAO that Creates, Updates and Deletes a single record in the database. (This DAO does not validate any data. It only assumes the data passedto it has already been validated.) This is my current situation as mentioned above: TheForm -> Bean -> DAO -> Database If I need to validate the data from the form, where would the logic reside? Should I use: TheForm -> TheFormValidationObj -> Bean -> DAO -> Database Or, do I put the validation in one of the existing layers? Keep in mind that I will probably need to reuse some of the validation functions for other objects. If anyone could post a fully-working sample of this simple application, I'm sure many others would greatly appreciate it. I have a simple working application, but, being new to any OOP thinking, some things just don't "feel right" to me. Thanks M!ke ---------------------------------------------------------- You are subscribed to cfcdev. To unsubscribe, send an email to [EMAIL PROTECTED] with the words 'unsubscribe cfcdev' in the message of the email. CFCDev is run by CFCZone (www.cfczone.org) and supported by Mindtool, Corporation (www.mindtool.com). An archive of the CFCDev list is available at www.mail-archive.com/[email protected]
