struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Craig R. McClanahan" <craig...@apache.org>
Subject Re: DynaActionForm Advantages
Date Tue, 09 Jul 2002 19:39:29 GMT


On Tue, 9 Jul 2002, Glen Mazza wrote:

> Date: Tue, 9 Jul 2002 14:33:46 -0500 (CDT)
> From: Glen Mazza <glenmazza@yahoo.com>
> Reply-To: Struts Users Mailing List <struts-user@jakarta.apache.org>
> To: struts-user@jakarta.apache.org
> Subject: Re:  DynaActionForm Advantages
>
> > Fecha: Tue, 9 Jul 2002 09:47:07 -0700 (PDT)
> > De: "Craig R. McClanahan" <craigmcc@apache.org>
> > A: Struts Users Mailing List
> > <struts-user@jakarta.apache.org>
> > Asunto: Re:  DynaActionForm Advantages
> >
> > >
> > > The problem was that the DAF class was not made
> > final.
> > >  Allowing it to be subclassed is creating the mess
> > you
> > > describe--the variables in the XML file and
> > actions on
> > > them in the DAF subclass.  (Another was writing
> > about
> > > putting member variable initializations in the
> > > validate() function--the DAF subclass may also
> > start
> > > encouraging other messier programming habits.)
> > >
> > > As for those who don't like getter/setters and
> > want to
> > > use the common-beanutils "get" functions described
> > by
> > > Craig:  Might it have been better, in addition to
> > > making the DAF class final,
> >
> > Making DAF final would have prevented the use case
> > where you want to
> > subclass it for custom reset() or validate()
> > methods.  This would have
> > forced the use of two classes instead of one -- IMHO
> > that would have been
> > more confusing, not less.
> >
>
> Exactly--that's the advantage of making the DAF final!
> If one wishes to have custom reset() or validate()
> methods, one needs to trot back to the ActionForm.
> The only programming/configuration of any type you
> should be able to do for a DAF is in the form beans
> section of the struts-config file.
>
> The DAF seems to me just a nice enhancement from 1.0.2
> because you no longer need to create ActionForm
> subclasses for jsp's not needing validation.
>
> And AF is then for when you do have specific
> validation--and it would be good if we can give
> programmers the option in the future of using either
> the beanutils get()/set() functions or the JavaBeans
> getter/setter functions within the AF.
>

I don't buy this argument at all.

It is still easier to write a DAF subclass with a custom reset() or
validate() than a corresponding AF subclass -- because with DAF you still
get to skip writing the getters and setters.  Crippling DAF, and forcing
people back to AF solely for this purpose, is not helpful.

> Glen

Craig


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


Mime
View raw message