Domanda

As we all know that 3 kind of error present in Thymeleaf . Such as FieldError,AllError and Global Error.

Can any body give me some idea about the Global Error? How to display the Global Error? Why do we need the Global Error as we've AllError ?

Thanks in Advance.

È stato utile?

Soluzione

According to the Thymeleaf documentation:

Field errors and All errors looks pretty much like the same thing (all errors is just a list of every field error which occured). Global errors are not necessarily associated with fields in form:
Quote (documentation, chapter 8.3):
There is a third type of error in a Spring form: global errors. These are errors that are not associated with any specific fields in the form, but still exist.

Hope it clarifies error types.

Altri suggerimenti

To refine Iwo Kucharski answer: Global errors are class level errors.

These errors usually are bound to validations that checks multiple fields in the form. These fields by themselves could have valid values, but a certain combination of both could not be valid, in that case, to which field do you attach the error? to neither of these, you consider it a global error.

Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top