DynaActionForms as cool as they are are more trouble than they're worth unless its a small simple form. For one thing you don't find out what's wrong until runtime.

I just use strings for dynaaction forms as it works, the problems our in part caused (i think) by the conversions done by beanutils (org.apache.commons.beanutils). Validator validates stuff even of type string.

if/when you use action forms, the typing issues are less of a pain. I know that its discouraged according to the party line. But then those aren't the folks paying you are they.

Part of the problem is that action forms are strongly coupled to the presentation layer, but sometimes its handy to be able to copy the properties from your model beans to the servlet layer. Often this means having both groups of beans looking pretty much the same, but some MVC purists claim this is the devils work as you're not decoupling enough. While I symathise with this position, its often not pragmatic to go down this route at an early stage of a project. In fact I've been known to nest model beans in action forms, and re-factor later to decouple, while I know this breaks with MVC the folks paying for work don't really give a toss whether its mvc or not.

I'm not saying break with the world according to these folks who know better than me, but just that sometimes its important to understand their focus is different to some of us. While they're laying out road maps for future technologies, publishing books and suchlike. We're stuck in an "is and ought" dilemma, between clients/bosses and trying to craft the best app we can.

So IMO careful what you believe or you might end up trying to find the holy grail of tech development, while your productivity suffers.

My 2 pence.



On 17 Dec 2003, at 14:24, Engbers, ir. J.B.O.M. wrote:

Hi,

Both 'Struts in Action' and 'Programming Jakarta Struts' state that
ActionForms and DynaActionForms are nearly equivalent and the main advantage
of using DynaActionForms is that you don't have to declare all the getters
and setters.
In DynaAction Forms each property can be of a (array of a) primitive types.


Thanks to Pedro Salgado and Martin Gainty (see "Retrieving boolean
properties from a DynaActionForm" on december 16), I partially succeeded in
solving the first problem which only confronted me with the next problem :-(
And while looking for a solution to that problem, I found a bugreport
(23355) in which Craig states that


'Adding these (getInteger, getBoolean etc, Ben) would encourage a behavior
that Struts discourages -- using
non-String data types in a form bean.'


Maybe that this explains why I have only found examples that use
String-properties (which lead me to my first question: where can I find
examples that use non_string properties?) but it leaves me with the more
fundamental question:
Why do DynaActionForms offer the possibility to declare non-String
properties without supporting them?
Should I avoid using DynaActionForms at all and use the DynaValidatorForm?


Ben Engbers

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Reply via email to