|
Simon, I'm curious as to how you would structure a simple
application where a form provides input that is eventually stored in a
database.
These are a couple of the plans I have for such a
solution:
Solution #1
Form page is loaded
If this is a new form entry, an instance of a
data bean is created and initialized with default/empty
properties.
If this is a modification of an existing record, an
instance of a data bean is created by a DAO object.
The data bean's getters are used to populate the form
fields.
The form is submitted to itself.
The form data is loaded into a new instance of the data
bean.
The bean is passed into a form data validator
object.
The validator's validate() method is
called.
Any errors are recorded in an error handler
object.
If errors are found, the data bean's getters are used to
populate the form fields, again.
If no errors are found, the data bean is passed to the DAO
for insert/update
Solution #2
Basically, the same as solution #1, but without the separation of the
data bean and the validator.
The
validation is wrapped up in the data bean.
I know
that doesn't follow the best-practices, but, at this time, I don't see much need
in having two almost-identical objects. One with validation logic and one
without. Maybe I'm missing the point, but I need to start
somewhere.
Thanks
MAD
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Simon Horwith Sent: Tuesday, March 08, 2005 3:31 PM To: [email protected] Subject: Re: [CFCDev] Is Decorator What I Need or Just Extends? ~Simon Simon Horwith CIO, AboutWeb - http://www.aboutweb.com Editor-in-Chief, ColdFusion Developers Journal Member of Team Macromedia Macromedia Certified Master Instructor Blog - http://www.horwith.com---------------------------------------------------------- You are subscribed to cfcdev. To unsubscribe, send an email to [email protected] with the words 'unsubscribe cfcdev' as the subject of the email. CFCDev is run by CFCZone (www.cfczone.org) and supported by CFXHosting (www.cfxhosting.com). An archive of the CFCDev list is available at www.mail-archive.com/[email protected] |
- RE: [CFCDev] Is Decorator What I Need or Just Extends? Dawson, Michael
- Re: [CFCDev] Is Decorator What I Need or Just Extends... Simon Horwith
- RE: [CFCDev] Is Decorator What I Need or Just Extends... Dawson, Michael
- Re: [CFCDev] Is Decorator What I Need or Just Ext... Simon Horwith
- Re: [CFCDev] Is Decorator What I Need or Just Extends... Simon Horwith
- Re: [CFCDev] Is Decorator What I Need or Just Extends... Alex Sherwood
- Re: [CFCDev] Is Decorator What I Need or Just Ext... Bill Rawlinson
