Hi,
I am using a validator that wrapps a org.springframework.validation.Validator (because I have constraints defined by annotations).
In flow.xml has the model explicitly bound only some properties:Code:... import org.springframework.validation.Validator; @Component public class ModelValidator { @Autowired Validator validator; public void validateSomeState(Model model, ValidationContext context) { MessageContext messages = context.getMessageContext(); BindingResult result = new BeanPropertyBindingResult(model, "modelName"); MessageBuilder mb = new MessageBuilder(); validator.validate(model, result); for (FieldError error : result.getFieldErrors()) messages.addMessage(mb.error().source(error.getObjectName() + "." + error.getField()).defaultText(error.getDefaultMessage()).build()); } ...
how can I force the validator to validate only bound properties? The ValidationContext has knowledge of the boud properties (at least the default implementation) but I can't find a standard (non-reflective) way to use it. I think this is a common scenario, but didn't find anything usable for me...Code:<view-state id="someState" model="model" view="/someView"> <binder> <binding property="propertyOne" /> </binder> ...
Can anyone help me? Thanks.


Reply With Quote
