Reputation: 800
I have following code:
public class ReferEmailForm {
@Valid
@NotEmpty
private Set<@TypedEmail String> emails;
...
}
For some reason error from @TypedEmail
in BindingResult
is notified as attached to emails[]
field. Is there any option to override this name? I need this to be able to use <form:errors path="emails" />
in jsp. Current solution don't generate error message on form unfortunately.
Upvotes: 1
Views: 428
Reputation: 800
After searching for answer everywhere I just noticed how stupid mistake I did. Hibernate is resolving variable name as emails[]
because Set do not have index based access. After changing type to List
it returns emails[0]
which is way better.
Upvotes: 1