Re: Simple Web forms to create an EO object
Re: Simple Web forms to create an EO object
- Subject: Re: Simple Web forms to create an EO object
- From: "Arturo Perez" <email@hidden>
- Date: Wed, 04 Aug 2004 10:58:47 -0400
Amorya North wrote:
OK, multiple choice. Which is best for a simple form (eg a user
registration form) where one EO object needs to be created.
1. Create and insert the EOObject when the page is loaded. The form is
bound directly to this new EO object. Submit button just saves changes.
I think most people do this. There are some irritations with are
addressed via Wonder. Things like not erasing bad data on validation
failure.
If you do it this way make sure you implement
validationFailedWithException in the component implementing the form.
It makes things somewhat easier.
2. Page is bound to lots of temporary variables. Submit button creates
EOObject, populates it, and saves changes.
3. Other.
I'm currently trying to do method 1, since it avoids a zillion temporary
variables...
There's a design pattern for #2 called Data Transfer Object aka Value
Object aka Transfer Object. You should read about that for further
information. Personally, I found DTO/VO/TO really annoying to work with.
but I'm unsure whether it might be less secure and more
likely to end up with a blank record inserted or whatever.
Neither of those situations are likely with a straightforward WO
implementation. The most likely cause of security problems comes from
buffer overflow which is difficult-to-impossible in java. The proper
use of editing contexts prevent the second occurrence. If you make sure
your EO validates itself and you insert it at the beginning of your
process then bad data can't make it into your DB.
My PHP roots
would suggest method 2, as that's _all_ you can do in PHP, but it
strikes me that WO might have a better way.
Amorya
-arturo
_______________________________________________
webobjects-dev mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/webobjects-dev
Do not post admin requests to the list. They will be ignored.