Vaadin Bean Validation JSR-303 display issue form.validate() vs commit


I have an error display issue. When i call form.commit() it shows a row below the form with the first error. When i call form.validate() it does not show this error. However is if i call form.validate() then form.commit(), if there are no errors, am i doing validation twice? Once with the validate and once again inside the commit?

I attached a pic of whats happening.

I think that the reason is that doing validate() only throws the validation exceptions, commit() also sets the form error message. The commit() calls validate().

You should usually surround the commit() with try-catch-block in case it fails and possibly set the errors more properly. Otherwise the exceptios will fall back to the framework and the result is not always very pretty (exception dumps are shown in the error indicator, etc).