Here is what we have learned in this chapter:
Tapestry 5 comes with a powerful framework for user input validation. To use it, we have to do very little, while Tapestry does a lot for us—applies validators, decorates fields in error, and displays error messages.
We can provide custom error messages and
Regexp
patterns using message catalogs. Although this wasn't explained in the chapter, you can also change the styles used to display errors by overriding them in your stylesheet.Tapestry 5 comes with five validators that will cover most needs. You can combine several of them to achieve the desired result.
You can provide custom validation, for example cross-form validation, in the
validate
event handler.To validate the fields of
BeanEditForm
, the@Validate
annotation should be used on either the getter or setter method of the validated property in the edited class.
You have already seen that it is possible to have both application-wide and page-specific message catalogs, and the next...