Ted Husted wrote:
On Nov 2, 2007 2:50 PM, Brian Pontarelli <[EMAIL PROTECTED]> wrote:
I've completely moved away from methods and bangs. It makes the code
more readable, and maintainable in my opinion and it reduces the
learning curve considerably.

What do you do about use cases like skipping validation on input or
going elsewhere on cancel?
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.

I was planning on attempting a different validation and handling path that condensed this all some more using rails like POST only handling for validation and processing. That would remove a few annotations, but might not be worth it.

Anyways, I'll get that application up and running as soon as I can. Hopefully have it working over the weekend.

-bp


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to