I'm working on a Spring MVC application and have a question about spring validation. First, I have this action in my controller:
@RequestMapping(value = "/create", method = RequestMethod.POST, produces = "application/json")
public @ResponseBody
Employee employeeCreate(@Valid @RequestBody EmployeeModelCreate objModel) throws Exception {
...
}
And this is my EmployeeModelCreate
class:
public class EmployeeModelCreate implements Serializable {
...
@NotBlank(message = "...")
private String password;
@NotBlank(message = "...")
private String confirmPassword;
...
//Setters and Getters
}
Now, I want to have validation for comparing password
and confirmPassword
. This validation should be check equality of these two fields. How can I do that? Any help would be greatly appreciated.