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: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]



-- 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: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Reply via email to