0

What does DynaActionForm in struts actually do? It is said that "if we develop more and more struts application or Action classes then more and more ActionForms have to be created. Means, ActionForm for just about every piece of business logic that we would like to perform. This is time comsuming."

So DynaActionForm comes into picture which we are creating in struts-config.xml file.

But still we will have to create equal DynaActionFrom for those many business Aciton in struts-config.xml file for mapping.

Writing ActionFrom (not DynaActionForm ) is much more flexible ?

Please explain, How dynaActionForm behaviour ?

AmitG
  • 10,365
  • 5
  • 31
  • 52

2 Answers2

2

DynaActionForms don't require any (or much) Java code; ActionForms do.

This is stated in the docs:

Instead of creating a new ActionForm subclass and new get/set methods for each of your bean's properties, you can list its properties, type, and defaults in the framework's configuration file.

Dave Newton
  • 158,873
  • 26
  • 254
  • 302
  • Any how, we have to create those many for each and every Action. If we think that there is monotonous problem of writing setter/getter then we have eclipse/netbean which will generate method within a second. Do we have any such thing to write configuration of in struts-config.xml file? If not, then it is cumbersome to write tag for each and every Action class. – AmitG Feb 19 '13 at 15:34
  • @AmitG Yes, it's called "using templates in your IDE". – Dave Newton Feb 19 '13 at 21:26
2

The real purpose of DynaActionForm is during the creation of a prototype. At this time it will help the page developer who may not be very much familiar with the jsp to create a DynaForm and get the prototype working he doesn't need to get into the details of wroking in the java code.

But it is always better to create ActionForm than using DynaForm in the projects.

More detailed explanation

Vishal Vijayan
  • 308
  • 1
  • 4
  • 13