You need to cast ObjectError
to FieldError
and then you can retrieve the name of the affected field by calling getField()
.
spring MVC, get the value of the rejected field from ObjectError
-
03-06-2022 - |
Frage
I have already check the similar questions on so but I don't have anything matching.
I check if I have errors with:
result.getErrorCount() != 0)
and inside I have the list of errors using
List<ObjectError> ae = result.getAllErrors();
when I use the debug mode of eclipse and I check the field inside the list I have the good id in the form. But at runtime I'm unable to get the value by doing
for (ObjectError fe : result.getAllErrors())
{
fe.getField();
}
Lösung
Lizenziert unter: CC-BY-SA mit Zuschreibung
Nicht verbunden mit StackOverflow