I didn't get very far with the example application. But I should be able
to get that finished today. That application should illustrate exactly
how I've been doing things lately. The situation you brought up is
exactly the same one that we hit and I'm sure everyone else does
eventually. We did about 5 different variations on it and finally
settled on one approach we thought made the most sense.
To keep the discussion going, here's the overview:
Preparation is only do on the CRUD form using the action tag. This
removes the hit of preparing if the submission is successful. This
allows the application to GET add/edit and POST save/update while still
preparing the form whenever is required since the form controls
preparation rather than the actions.
I should have the application into the smart URLs repository pretty soon.
-bp
Ted Husted wrote:
The question would be how do we GET add or edit and invoke Prepare,
and then how do we POST to save, update, or delete, and invoke Prepare
if validation fails?
On Nov 2, 2007 3:30 PM, Brian Pontarelli <[EMAIL PROTECTED]> wrote:
I think my simple CRUD example will shed a lot of light on my methods,
but here's a rough run down:
Actions
------------
Add - Empty
Edit - Fetch entity by id
Prepare - Prepares selects and other associations for the form
Save - Validates and inserts
Update - Validates and updates
Delete - Deletes entity or multiple entities
Index - Displays the list of entities
Views
----------
add.jsp - Header block and includes form.jsp
edit.jsp - Header block and includes form.jsp
form.jsp - The form (uses the Prepare action)
index.jsp - The list page
The form has a cancel button that uses the "redirect-action:index"
syntax. The edit form also has a delete button that uses the action syntax.
The only place I use the input result is in the Save and Update classes
for results that go back to the add and edit JSPs. These two classes can
also be collapsed into a single class or use a parent class to reduce
overhead. Those two and delete are the only ones with annotations for
different results and redirects.
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]