The implementation with three classes for each form, Book, BookForm
, and BookAction
, which we have used up until now, is relatively time-consuming. DynaForms
help to lift the load somewhat, but there is still plenty of work left to do, which can be especially awkward for repetitive tasks that are boring and therefore error-prone.
The Validator, developed by David Winterfeldt, uses an XML file to contain the validation rules. The Validator can also generate JavaScript that can be used to provide client‑side verification. Its ability to use regular expressions in the validation rules is particularly helpful.
One disadvantage, as with many things in Struts, is that the Validator requires the context to be reloaded after every modification. This can make debugging difficult as any actions taken up to that point must be performed again.
Since Struts 1.1, the Validator and all the required JAR files have been packaged with the Struts download (in...