Page 2 of 2 FirstFirst 12
Results 11 to 14 of 14

Thread: Spring Web Flow 2.2.1 is out, Spring Web Flow 2.3.0 next

  1. #11
    Join Date
    Aug 2006
    Location
    Brooklyn
    Posts
    556

    Default

    That issue will also result in changes to SpringValidatorAdapter. That aside how do you imagine specifying validation groups for a given view state?

  2. #12

    Default

    Correct me if I'm wrong, but SpringValidatorAdapter already has:

    Code:
    public <T> Set<ConstraintViolation<T>> validate(T object, Class<?>... groups) {
    		return this.targetValidator.validate(object, groups);
    	}
    I'm writing a framework off of Webflow that allows validation groups to be specified using the fully qualified class name separated by commas. I split it and use the class loader to find groups by their name. I then collate them and pass them to the groups parameter [1]. I know that Seam remoting allows you to specify only the unqualified name which is much cleaner [2], but I don't know how it determines the correct type to use in this case.

    I imagine a neater way would be to define them within the view as a separate element similar to the way the 'binding' element operates?

    Regards,
    Paul

    [1] This is a bit tricky because 'groups' is an array of a generics but it is possible.
    [2] http://docs.jboss.org/seam/3/remotin...on.html#d0e742
    Last edited by Paul Wilson; Feb 28th, 2011 at 09:54 AM. Reason: Bad formatting

  3. #13
    Join Date
    Aug 2006
    Location
    Brooklyn
    Posts
    556

    Default

    Yes SpringValidatorAdapter does implement all javax.validation.Validator methods. However, the one invoked from ValidatorHelper is:

    Code:
    public void validate(Object target, Errors errors) { }
    The above method adapts Bean Validation errors and registers them with the Spring MVC Errors instance passed in. This way errors raised via JSR-303 validation can be treated as any other validation errors in Spring MVC with regards to being displayed through the form:errors tag or customized through the default MessageCodesResolver.

    Following the conventions approach used presently to discover validation methods and validator objects, we could try to come up with some suitable convention. Alternatively a view state attribute named "validationGroups" could be expected. The value would either be fully qualified class names or unqualified with the package of the model assumed by default. I suppose the common case would be one validation group per view state so even fully qualified wouldn't be too bad.

    If you don't mind please raise a ticket in JIRA as that would be a better place to capture this conversation.

  4. #14

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •