1

I want to create an annotation to compare password and confirm password forms.

I found this topic https://stackoverflow.com/a/2155576/10742172

so i have i few questions about it:

what does this line means

'''
"{constraints.fieldmatch"} ?
'''

how does annotation knows what fields to use?

@FieldMatch.List({
        @FieldMatch(first = "password", second = "confirmPassword", message = "The password fields must match"),
        @FieldMatch(first = "email", second = "confirmEmail", message = "The email fields must match")
})
public class UserRegistrationForm  {
    @NotNull
    @Size(min=8, max=25)
    private String password;

    @NotNull
    @Size(min=8, max=25)
    private String confirmPassword;

    @NotNull
    @Email
    private String email;

    @NotNull
    @Email
    private String confirmEmail;
}

how to put error message in jsp file?

I'm pretty new in it as you can see :)

Skyglar
  • 135
  • 3
  • 12

0 Answers0