DynamicActionForm eliminates the need of the FormBean class.The form bean definition can be written into the struts-config.xml file.
To reduce the development time for the developer,it makes FormBean declarative .
A D V E R T I S E M E N T
To create a Java class for each type of form bean,DynamicActionForm is used as the specialized subclass of ActionForm that allows the creation of the form beans with dynamic sets of properties, without requiring the developer.
We will recreate add form with the help of DynaActionForm in this tutorial.
In the action class,it also shows you how you can validate the use input.
Adding DynaActionForm Entry in struts-config.xml
At First,in the struts-config.xml file we will add necessary entry .
The form bean is of the org.apache.struts.action.DynaActionForm type.
To define the property for form bean,the <form-property/> tag is used .
Three properties for our dynamic form bean.
In index.jsp,add the following line to call the form.
Action Form Example</html:link>
Example shows you how to use DynaActionForm.
Building Example and Testing
Go to Struts\strutstutorial directory and type ant on the command prompt to build and deploy application.
This will help to deploy application.
Open the browser and type DynaAddress.jsp page.
In the form,without entering anything and submitting the submit button.