*
The moose likes Struts and the fly likes Why use DynaActionForm? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "Why use DynaActionForm?" Watch "Why use DynaActionForm?" New topic
Author

Why use DynaActionForm?

Timothy Sam
Ranch Hand

Joined: Sep 18, 2005
Posts: 746
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!


SCJP 1.5
http://devpinoy.org/blogs/lamia/ - http://everypesocounts.com/
Merrill Higginson
Ranch Hand

Joined: Feb 15, 2005
Posts: 4864
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");


Merrill
Consultant, Sima Solutions
Timothy Sam
Ranch Hand

Joined: Sep 18, 2005
Posts: 746
Thanks Merill! I think I'll stick with ActionForm/ValidatorForm then... Thanks!
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Why use DynaActionForm?
 
Similar Threads
dynaactionform and hibernate
validation.xml check date conflict (and when to use DynaActionForm)
why do i need to use a DynaActionForm
What are the drawbacks of DynaActionForm
ActionForm with indexed properties