2017  Kodetalk | Feedback | Privacy Policy | Terms | About

what are the different type of Action forms in struts

I want to know about the action form types supports in struts and little more details on this.

You can divide Form Beans into two types.

  1. Static Forms
  2. Dynamic Forms

Static Forms :

There are three types of Static Forms.

  • ActionForm
  • ValidatorForm
  • ValidatorActionForm

When you are using the Static Form, you need to do the following things.

  • You need to write a Java class by extending one of the above mentioned Static Forms.
  • You need to declare the fields same as JSP forms.
  • You need to write the set/get methods for all the fields.
  • If you want to validate form data you need to override the validate() method in the Form Bean class.
  • If you want to reset your form fields ,you need to override the reset() method in the Form Bean class.

Dynamic Forms :

There are three types of Dynamic Forms.

  • DynaActionForm
  • DynaValidatorForm
  • DynaValidatorActionForm

When you are using the Dynamic Form, you need to do the following things

  • Write the field declaration inside the struts configuration file(No need to write Java class with private field and set/get method).
  • DynamicForms will reset automatically to default values(No need to override reset method).
  • Dynamic forms will use validation framework for the form validations (No need to override the validate method)

Answer is