we try to avoid the session as much as possible and wherever possible only
pass information via url encoded params, hidden fields or with a class
called ParameterActionForward it allows you to add request params to a
forward.  I originally found on the list and have reposted several times.
We also use ted husted's tip http://husted.com/struts/tips/001.html so that
we can place buttons on page that will indicate what action to take..  Using
a combination of the buttons and the ParamActionForward allows us to respond
to events without passing around an action param indicating the actions mode
(similar to how the dispatch action would handle).    


-----Original Message-----
From: Mark Lowe [mailto:[EMAIL PROTECTED]
Sent: Tuesday, March 30, 2004 11:52 AM
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]

Reply via email to