This week's book giveaway is in the OO, Patterns, UML and Refactoring forum. We're giving away four copies of Refactoring for Software Design Smells: Managing Technical Debt and have Girish Suryanarayana, Ganesh Samarthyam & Tushar Sharma on-line! See this thread for details.
I've read an article about DynaActionForm... However... I could not grasp its usefulness in my application... If I use it instead of ValidatorForm... Will I still be able to perform automated validation? What's the essence of it? Thanks!
With a DynaActionForm, instead of writing classes that extend ActionForm, you define all your form beans as DynaActionForm, and define the properties for each form in the struts-config.xml file. If you want to use this functionality AND still use the Struts Validator framework, you will use DynaValidatorForm instead of DynaActionForm.
Some developers prefer defining things in XML to writing javaBeans. I happen to prefer writing beans that extend ActionForm to using DynaActionForm. Using an IDE such as Eclipse, they're very easy to write, thanks to automatic getter and setter code generation. Another big advantage they have over DynaActionForm is that if you spell one of the properties wrong in your Action class, the compiler will tell you. That is not the case with a DynaActionForm.
Also, to me, writing myBean.getLastName() is much simpler and more intuitive than writing (String)myDynaForm.get("lastName");