比Jaiwo99更进一步:
// org.springframework.validation.SmartValidator - implemented by// LocalValidatorFactoryBean, which is funny as it is not a FactoryBean per se (just saying)@AutowiredSmartValidator validator;public String saveAccount(@ModelAttribute Account account, BindingResult result) { // ... custom logic validator.validate(account, result, Account.Step1.class); if (result.hasErrors()) { // ... on binding or validation errors } else { // ... on no errors } return "";}
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)