Well i prefer having many buttons per form, form buttons not links, while preferring this I also prefer having an action per button.

Lets say we've a form with an edit, save, add, delete and various other bits n pieces. Or do you have to use links?

In fact i've tried this using links and any nested beans get dropped using lazy list or not.

On 30 Mar 2004, at 19:28, <[EMAIL PROTECTED]> wrote:

Hello Mark,
I have used the same approach(1 action per functionality..So 3 different actions for insert/update/delete)


But I have never used session scoped forms.

I am not sure why do u need to have session scoped forms?

Also as far the design decision about which way is better(1 action for CRUD operations or different actions),there are different opinions on this mailing list.Some people find it easier if 1 action is doing all related operations.they just provide different methods on same action and use DispatchAction(or some similar in struts) which will call the correct method on the called action using reflection, depending on the value of parameter passed.

So it is upto you to decide which style suits you better.

With approach one(1 action per functionality..So 3 different actions for insert/update/delete), you have very atomic actions which can be reused indenpendtly very easily.But you have too many action mappings to define.
With approach 2, you have less Action mappings to deal with.



HTH.


Regards,
Shirish



-----Original Message-----
From: Mark Lowe [mailto:[EMAIL PROTECTED]
Sent: Tuesday, March 30, 2004 6:52 PM
To: Struts Users Mailing List
Subject: Re: One Action class but more than one functionality


Sure but I found that you need to always need to scope to session. And/or have links in you forms. Or create a javascript dependency changing the action.

or have you a way aorund this problem using actions?

On 30 Mar 2004, at 18:33, Menke, John wrote:

we have found that implementing 1 action for add 1 action for edit
etc... is
better from the standpoint of maintainability.  (it's easier to find
the
edit code if it's in the edit Action) we avoid code duplication by
making
abstract actions that contain the duplicated code

ie.

AbstractPersonAction - contains common code for person creation update
delete, etc...
AddPersonAction - add specific code
EditPersonAction - edit specific code


btw. we also try to keep 3 seperate jsps. this may seem like more work but the complications that can arise from having too many <choose> tags in your jsps to switch between modes outweigh the addition overhead of extra jsps in the long run.

-----Original Message-----
From: Joao Batistella [mailto:[EMAIL PROTECTED]
Sent: Tuesday, March 30, 2004 11:28 AM
To: 'Struts Users Mailing List'
Subject: One Action class but more than one functionality


Hello. I have an action class to create, edit and remove a Person, for example. Is this a poor decision? I mean, should I create 3 action classes, one for create, another for edit and another one for remove? Does struts have a mechanism to help me in that? Thanks all.

---------------------------------------------------------------------
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]


--------------------------------------------------------------------- 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]



Reply via email to