package eu.smartlm.abs.portal.security.login.admin; import org.springframework.validation.Errors; import org.springframework.validation.ValidationUtils; import org.springframework.validation.Validator; import eu.smartlm.abs.portal.security.login.model.User; /** * Validates that user is ok when the data is introduced in the form * @author David García Pérez - CESGA */ public class MyValidator implements Validator { public boolean supports(Class klass) { return User.class.isAssignableFrom(klass); } public void validate(Object target, Errors errors) { //User user = (User) target; ValidationUtils.rejectIfEmptyOrWhitespace(errors, "username", "NotEmpty.user.username"); ValidationUtils.rejectIfEmptyOrWhitespace(errors, "password", "NotEmpty.user.password"); } }