java - Spring MVC - validation for comparing two fields -
i'm working on spring mvc application , have question spring validation. first, have action in controller:
@requestmapping(value = "/create", method = requestmethod.post, produces = "application/json") public @responsebody employee employeecreate(@valid @requestbody employeemodelcreate objmodel) throws exception { ... } and employeemodelcreate class:
public class employeemodelcreate implements serializable { ... @notblank(message = "...") private string password; @notblank(message = "...") private string confirmpassword; ... //setters , getters } now, want have validation comparing password , confirmpassword. validation should check equality of these 2 fields. how can that? appreciated.
you make custom validation class, need implement validator interface, can use manually, or bind spring mvc controller, using @initbinder annotation.
this question may contain other useful information.
Comments
Post a Comment