You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Jerry Jalenak <Je...@LABONE.com> on 2002/07/08 20:03:48 UTC

DynaActionForm Advantages

All,

What are the advantages to using DynaActionForms over the traditional Struts
ActionForms?  I'm in the process of looking at some of the newer features of
Struts 1.1, and frankly, I don't see where DynaActionForms is going to do
much for me.  In fact, in my limited view of the universe, it looks like
DynaActionForms are a move back toward a standard servlet, one where you
access HTML form data through a 'request.getParameter("form-variable")'.
Also, it would appear that the use of DynaActionForms forces all of the form
validation into the Action, making the Action more complex than it needs to
be (compared to the 'validate' method of the ActionForm).

What am I missing?  There must be some advantage to the use of
DynaActionForms....


Thanks.

Jerry Jalenak
Development Manager, Web Publishing
LabOne, Inc.

This transmission (and any information attached to it) may be confidential and is intended solely for the use of the individual or entity to which it is addressed. If you are not the intended recipient or the person responsible for delivering the transmission to the intended recipient, be advised that you have received this transmission in error and that any use, dissemination, forwarding, printing, or copying of this information is strictly prohibited. If you have received this transmission in error, please immediately notify LabOne at (800)388-4675.



--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Re: DynaActionForm Advantages

Posted by "Craig R. McClanahan" <cr...@apache.org>.

On Mon, 8 Jul 2002, Jerry Jalenak wrote:

> Date: Mon, 8 Jul 2002 13:03:48 -0500
> From: Jerry Jalenak <Je...@LABONE.com>
> Reply-To: Struts Users Mailing List <st...@jakarta.apache.org>
> To: "'struts-user@jakarta.apache.org'" <st...@jakarta.apache.org>
> Subject: DynaActionForm Advantages
>
> All,
>
> What are the advantages to using DynaActionForms over the traditional Struts
> ActionForms?  I'm in the process of looking at some of the newer features of
> Struts 1.1, and frankly, I don't see where DynaActionForms is going to do
> much for me.  In fact, in my limited view of the universe, it looks like
> DynaActionForms are a move back toward a standard servlet, one where you
> access HTML form data through a 'request.getParameter("form-variable")'.
> Also, it would appear that the use of DynaActionForms forces all of the form
> validation into the Action, making the Action more complex than it needs to
> be (compared to the 'validate' method of the ActionForm).
>
> What am I missing?  There must be some advantage to the use of
> DynaActionForms....
>

The benefit of using DynaActionForm instead is in one of the following two
use cases:

* If your ActionForm bean doesn't have a custom reset() or validate()
  method, you don't need to write your own form bean class at all --
  simply configure the properties in struts-config.xml.

* If your ActionForm bean does have a custom reset() or validate() method,
  those are the only ones you have to write -- no more time wasted with
  all the property getter and setter methods (have you ever done anything more
  boring that writing those?).  Simply subclass DynaActionForm and
  implement the validate() method in the usual way (although it will
  have to use get() to get the values to be tested, instead of the
  usual property getter methods).

Given how many situations are covered by one or the other of the above,
I'd say DynaActionForm is modestly useful :-).  But, like most things,
it's just an option.

Craig


--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>