You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Raghuveer <ra...@infotechsw.com> on 2006/10/14 13:01:31 UTC
ActionForm to DAO
Can we send ActionForm as argument to a method in DAO class from Action
Class.
What is Best Practice ?
Thanks and Regards,
Raghuveer
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org
Re: ActionForm to DAO
Posted by Laurie Harper <la...@holoweb.net>.
Raghuveer wrote:
> Can we send ActionForm as argument to a method in DAO class from Action
> Class.
Can you? yes. Should you? almost certainly not.
> What is Best Practice ?
You should keep your model decoupled from your view. Passing Struts
artifacts like action forms into the data access layer creates
undesirable dependencies between layers, as well as making your model
layer harder to unit test.
Action forms are intended as an intermediate representation of form
data, not as general DTOs. If you need to pass data into a DAO, pull it
out of your form bean and wrap it into a model-centric, type-safe
transfer object.
L.
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org