You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by as...@freddiemac.com on 2004/10/29 19:47:26 UTC

In MVC is actionform considered a part of the view or the controller?

There seems to be some disagreement among my collegues regarding wether 
actrionform is logically is part of View or the Controller in MVC, this is 
relevent to us in drawing high level sequence diagrams.  I personally feel 
that it is a part of the view, because if a request goes to the view and 
validation fails, an error message is returned to the user without 
invoking any controller logic.  Any opinions?  Thanks.

Re: In MVC is actionform considered a part of the view or the controller?

Posted by as...@freddiemac.com.
  Thanks so much Craig, that answers my question perfectly! 

-Asif 





"Craig McClanahan" <cr...@gmail.com> 
10/29/2004 01:59 PM
Please respond to
"Struts Users Mailing List" <us...@struts.apache.org>; Please respond to
craigmcc@apache.org


To
"Struts Users Mailing List" <us...@struts.apache.org>
cc

Subject
Re: In MVC is actionform considered a part of the view or the controller?






The original design intent is that an ActionForm is indeed part of the
view tier.  It's *only* purpose in life is to provide a spot on the
server side to hold the values that the user has entered on a form,
even if they are not semantically valid, so that they can be
reproduced in the case of validation errors.

For example, consider an input field that should accept an integer (so
you've got a validation rule on it).  If your user types "1a3" instead
of "123", what they expect to get back is an error message about the
validation failure, *and* they expect to see the "1a3" that they
originally typed.  That's what the ActionForm enables in the Struts
architecture.  If you were to accomplish this task in a different way,
you could bypass the use of ActionForms entirely, with zero impact on
the controller tier.

Component oriented architectures (like JavaServer Faces) do this sort
of thing inside the components themselves, but it's definitely a view
tier thing.

Craig McClanahan


On Fri, 29 Oct 2004 13:47:26 -0400, asifur_rahman@freddiemac.com
<as...@freddiemac.com> wrote:
> There seems to be some disagreement among my collegues regarding wether
> actrionform is logically is part of View or the Controller in MVC, this 
is
> relevent to us in drawing high level sequence diagrams.  I personally 
feel
> that it is a part of the view, because if a request goes to the view and
> validation fails, an error message is returned to the user without
> invoking any controller logic.  Any opinions?  Thanks.
>

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




Re: In MVC is actionform considered a part of the view or the controller?

Posted by Craig McClanahan <cr...@gmail.com>.
The original design intent is that an ActionForm is indeed part of the
view tier.  It's *only* purpose in life is to provide a spot on the
server side to hold the values that the user has entered on a form,
even if they are not semantically valid, so that they can be
reproduced in the case of validation errors.

For example, consider an input field that should accept an integer (so
you've got a validation rule on it).  If your user types "1a3" instead
of "123", what they expect to get back is an error message about the
validation failure, *and* they expect to see the "1a3" that they
originally typed.  That's what the ActionForm enables in the Struts
architecture.  If you were to accomplish this task in a different way,
you could bypass the use of ActionForms entirely, with zero impact on
the controller tier.

Component oriented architectures (like JavaServer Faces) do this sort
of thing inside the components themselves, but it's definitely a view
tier thing.

Craig McClanahan


On Fri, 29 Oct 2004 13:47:26 -0400, asifur_rahman@freddiemac.com
<as...@freddiemac.com> wrote:
> There seems to be some disagreement among my collegues regarding wether
> actrionform is logically is part of View or the Controller in MVC, this is
> relevent to us in drawing high level sequence diagrams.  I personally feel
> that it is a part of the view, because if a request goes to the view and
> validation fails, an error message is returned to the user without
> invoking any controller logic.  Any opinions?  Thanks.
>

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