[prev in list] [next in list] [prev in thread] [next in thread] 

List:       struts-user
Subject:    RE: struts-faces
From:       "Andrew Hill" <andrew.david.hill () gridnode ! com>
Date:       2003-09-18 11:04:28
[Download RAW message or body]

Of course theres an even simpler way to get fresh actions each time - just a
few lines change in your request processor. Have it return a new instance
each time and dont bother with caching it...

-----Original Message-----
From: Ted Husted [mailto:husted@apache.org]
Sent: Thursday, 18 September 2003 18:57
To: Struts Users Mailing List
Subject: Re: struts-faces


Likewise, if anyone really wanted throwaway, non-threadsafe Actions,
there's a nice technique that Maverick uses. A regular singleton Action
is used as a wrapper. When execute is called, the wrapper instantiates a
new instance of the desired type and returns the outcome of its execute.
  But the ActionForm technique Greg describes would be an even better
way to create throwaway Actions.

Gregory Seidman wrote:
> On Wed, Sep 17, 2003 at 01:14:27PM +0200, Adam Hardy wrote:
> } I remember a while ago in one of these architecture- theme emails you
> } discussed the OO nature of struts & it had been said that the
> } action-form class and the action class broke the OO encapsulation
> } principle, by having data in one and functionality in another. You said
> } if you were going to design struts again, you would probably address
this.
> [...]
>
> This is a quibble. If you want to put your functionality into your
> ActionForm class, go ahead. Create an abstract ActionForm subclass that
has
> a takeAction() pure virtual method in it (with appropriate arguments).
> Create an Action class which does nothing more than cast to your
ActionForm
> subclass and call takeAction(). There you go, functionality in the same
> class that holds the data.
>
> } Adam
> --Greg
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: struts-user-help@jakarta.apache.org
>
>

--
Ted Husted,
   Junit in Action  - <http://www.manning.com/massol/>,
   Struts in Action - <http://husted.com/struts/book.html>,
   JSP Site Design  - <http://www.amazon.com/exec/obidos/ISBN=1861005512>.



---------------------------------------------------------------------
To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: struts-user-help@jakarta.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: struts-user-help@jakarta.apache.org

[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic