Q).what is a DynaAction?
Why actually we need DynaAction Form this is the real question,one proverb is there "necessity is the mother of invention " this proverb is applicable here.
Starting from Struts 1.0 where we are having one jsp page ,one form bean is there which has all setter() and getter() mehod and one action class is there which has the execute() method,there was a overhead of creating a form bean for ever method, so they came up with the idea of DynaActionForm bean, where all the from properties are defined in the Struts configuration file,so that creation of the concrete class can be avoided.
Then came Struts2 where there is a single java class, where we are having all the from properties and the execute() method,so if you had noticed there nothing called DynaAction Form in Struts2.0,since all the form properties are defined in the action class it shelf,no need to define the form properties in the sturts configuration file .
Why actually we need DynaAction Form this is the real question,one proverb is there "necessity is the mother of invention " this proverb is applicable here.
Starting from Struts 1.0 where we are having one jsp page ,one form bean is there which has all setter() and getter() mehod and one action class is there which has the execute() method,there was a overhead of creating a form bean for ever method, so they came up with the idea of DynaActionForm bean, where all the from properties are defined in the Struts configuration file,so that creation of the concrete class can be avoided.
<
form-beans
>
<
form-bean
name
=
"LoginForm"
type
=
"org.apache.struts.action.DynaActionForm"
>
<
form-property
name
=
"userName"
type
=
"java.lang.String"
/>
<
form-property
name
=
"password"
type
=
"java.lang.String"
/>
</
form-bean
>
</
form-beans
>