How to trigger validate () method of ActionForm?
-
validate="false"
-
validate="true"
-
validate="yes"
-
validate="no"
The validate() method is triggered by setting validate="true" in the action mapping within struts-config.xml. This tells the controller to invoke validation before executing the Action.
To trigger the validate() method of an ActionForm, you need to set the validate attribute to "true".
Explanation of each option:
A. validate="false": This option will not trigger the validate() method of the ActionForm. It disables the validation process.
B. validate="true": This option will trigger the validate() method of the ActionForm. It enables the validation process.
C. validate="yes": This option is not a valid attribute value for the validate attribute. It will not trigger the validate() method.
D. validate="no": This option is not a valid attribute value for the validate attribute. It will not trigger the validate() method.
Therefore, the correct answer is B) validate="true". This option enables the validation process and triggers the validate() method of the ActionForm.