Error Messages

Learn how to add validation messages for validation errors in the form.

Thymleaf has the #fields.hasErrors method available in templates that allow us to check whether there is a validation error on a field.

Adding validation to firstName

We can apply this to the firstName property, for example:

Get hands-on with 1000+ tech skills courses.