When should we use ValidatorForm, ValidatorActionForm, and their dynamic variants in struts based applications?
Asked
Active
Viewed 1,502 times
1 Answers
1
The difference is that the validation rules of a ValidatorActionForm
are not assigned to the action form but to the action (/path-to-action.do
). So it is possible to reuse a bean in multiple actions but to define different validations for each action.
<form-validation>
<formset>
<!-- validation mapping for action /example1 -->
<form name="/example1">
...
</form>
</formset>
<formset>
<!-- validation mapping for action /example2 -->
<form name="/example2">
...
</form>
</formset>
</form-validation>
See also:
- You may want to see the Struts Validator Guide.
- https://www.laliluna.de/articles/chronological.html contains excellent examples for Struts 1.x
- Java: Struts :ValidatorForm Vs ValidatorActionForm is a comparison of the two classes that you mention

Paul Vargas
- 41,222
- 15
- 102
- 148