On Mon, 8 Jul 2002, Jerry Jalenak wrote:

> Date: Mon, 8 Jul 2002 13:03:48 -0500
> From: Jerry Jalenak <[EMAIL PROTECTED]>
> Reply-To: Struts Users Mailing List <[EMAIL PROTECTED]>
> To: "'[EMAIL PROTECTED]'" <[EMAIL PROTECTED]>
> 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:   <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>

Reply via email to