For all my form submissions, I am creating documents to take in the submitted information
e.g. public static void formAction(@Valid FormDocument formDocument){ ... }
I like this as it keeps my controllers looking tidy and makes it easier to see what is being requested in a form.
My registration document looks (trimmed) like this:
@Email
@Required
public String email;
@Required
public String password;
@Required
public String confirmPassword;
My question is is there a way I can check that the password matches the confirmPassword field within this class itself. Currently I am checking in the controller and passing a validation message back in if it fails. I think it would be neater if it was done inside the document itself.
Thanks for any feedback/answers in advance!