What is the difference between ActionForm and DynaActionForm

Showing Answers 1 - 12 of 12 Answers

vamshi

  • Mar 18th, 2005
 

In struts 1.0, action form is used to populate the html tags in jsp using struts custom tag.when the java code changes, the change in action class is needed. To avoid the chages in struts 1.1 dyna action form is introduced.This can be used to develop using xml.The dyna action form bloats up with the struts-config.xml based definetion.

  Was this answer useful?  Yes

jagadish kumar

  • Jul 13th, 2005
 

There is no need to write actionform class for the DynaActionForm and all the variables related to the actionform class will be specified in the struts-config.xml 
where as we have to create Actionform class with getter and setter methods which are to be populated from the form

  Was this answer useful?  Yes

PRATAP_k

  • Jul 17th, 2005
 

if the formbean is a subclass of ActionForm, we can provide reset(),validate(),setters(to hold the values),gettters whereas if the formbean is a subclass to DynaActionForm we need not provide setters,getters but in struts-config.xml we have to configure the properties in using .basically this simplifies coding

  Was this answer useful?  Yes

Anindit Sinha

  • Aug 23rd, 2005
 

An ActionForm represents an HTML form that the user interacts with over one or more pages. You will provide properties to hold the state of the form with getters and setters to access them.  
Maintaining a separate concrete ActionForm class for each form in your Struts application is time-consuming. It is particularly frustrating when all the ActionForm does is gather and validate simple properties that are passed along to a business JavaBean.  
 
This bottleneck can be alleviated through the use of DynaActionForm classes. 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 Struts configuration file.  

  Was this answer useful?  Yes

Gandhiraj from Ewaksoft

  • Aug 24th, 2005
 

If you are using actionform then you should specify the getter and setter for each components of presentation (jsp ) in to FormBean file.So it is some what complecated one to specify each component for setter and header. To avaid this method we are having DynoActionForm.In struts-config.xml file we can specify the properties.  
 

  Was this answer useful?  Yes

SNMP

  • Sep 3rd, 2005
 

Action form pls refer SNMP7.3 
DynaAction form pls refer SNMP7.3 

  Was this answer useful?  Yes

Amit Mudgal

  • Sep 21st, 2005
 

In case of the ActionForm user himself has to write the setters and getters when ever he adds a control. The same process is repeated again and again when user creates a view. DynaActionForm eliminates this burden and creates the form bean itself. This way we don't have to write setters and getters...infact we don't have to give any bean class. To use DynaAction Form, we have to declare the form bean as a DynaActionForm Type in struts-config.xml. You will have to declare the properties and their type too.

  Was this answer useful?  Yes

prabhaker

  • Oct 31st, 2005
 

Dyna Action form is a Generic Action form which can be represent a form.The properties of the form bean can be represent at the time of Deploying the application.

Where as in the Action form the propeties are mentioned or tightly coupled to the form.

In Dyna action form of struts-config .xml file

  Was this answer useful?  Yes

prabhaker

  • Oct 31st, 2005
 

Dyna Action is a Generic action form which represents a form.

properties of the form are decided at the timeof deplying the application.

Where as in Action form form field propertie are decided when we develop the application ,there is no chance if in future we want to change any modyfication without changing the entire application.

  Was this answer useful?  Yes

Sunil Thomas

  • May 24th, 2007
 


You can get the correct picture about DynaAction Form here
http://struts.apache.org/1.3.8/userGuide/building_controller.html#dyna_action_form_classes


And in the action class, we retrieve a particular property of the DynaActionForm as follows

        DynaActionForm userForm= (DynaActionForm)form;
   
        int userId= ((Integer)userForm.get("userId")).intValue();

  Was this answer useful?  Yes

raj.ntrj

  • Nov 11th, 2008
 

In ActionForm we have to provide setters() and getters(),if we want to add more properties we have to provide to provide that much of setters() and getters().
Apace people found that there is a burden on ActionForm, so they developed another class class called DynaActionForm, which is a sub-class of ActionForm, instead of providing setters() and getters() in Form, they suggested that provide the properties in struts-config.xm, under struts-config.xml they provide a tag called FormBean in which we can provide the properties name, internally struts software manage to generate setters() and getters().

  Was this answer useful?  Yes

devabscmca

  • Oct 6th, 2010
 

ActionForm is static form bean and DynaActionForm is dynamic formbean. If we want to use DynaActionForm no need write formbean we need to write all the jsp fields in Sturts-config.xml 

  Was this answer useful?  Yes

Give your answer:

If you think the above answer is not correct, Please select a reason and add your answer below.

 

Related Answered Questions

 

Related Open Questions