DynaActionForm is specialized subclass of ActionForm that allows the creation of form beans with dynamic sets of properties, without requiring the developer to create a Java class for each type of form bean.
DynaActionForm eliminates the need of FormBean class and now the form bean definition can be written into the struts-config.xml file. So, it makes the FormBean declarative and this helps the programmer to reduce the development time.
1) Adding DynaActionForm Entry in struts-config.xml
<form-bean name="DynaAddressForm"
type="org.apache.struts.action.DynaActionForm">
<form-property name="name" type="java.lang.String"/>
2)
In action class, cast it DynaActionForm addressForm = (DynaActionForm)form;
3) Use get function , String name=addressForm.get("name")
No comments:
Post a Comment