tapestry-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Matthias Melitzer (Updated) (JIRA)" <j...@apache.org>
Subject [jira] [Updated] (TAP5-1718) Tapestry-beanvalidator isn't validating nested DTO objects / Doesn't mark the invalid fields in the UI
Date Mon, 24 Oct 2011 14:13:32 GMT

     [ https://issues.apache.org/jira/browse/TAP5-1718?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]

Matthias Melitzer updated TAP5-1718:
------------------------------------

    Description: 
Tapestry-beanvalidator isn't validating nested objects correctly, the problem is that component
parameters i.e. the TextField#value is only bound to the attribute itself but doesn't contain
the full objectpath, so using a DTO like:

class TestDTO {
   @NotNull
   private String firstName;
   @Valid
   private EmbeddedObject embeddedObject;
...
}
class EmbeddedObject {
   @NotNull
   private String lastName;
...
}

Using the TestDTO on a page in the following way:
class MyPage{
...
   @Property
   private TestDTO testDTO;

   @Component(parameters = {"validate=testDTO"})
   private Form form;

   @Component(parameters = {"value=testDTO.firstName"})
   private TextField firstName;

   @Component(parameters = {"value=testDTO.embeddedObject.lastName"})
   private TextField embeddedField;
...
}

Submitting the form validates all the attributes correctly (also the embedded object validation
error is listed in the t:errors component) but when it comes to BeanFieldValidator only lastName
is on the Environment Stack in the BeanValidationContext. As TestDTO doesn't contain the property
lastName and there's no objectpath available it doesn't traverse down the objects and can't
assign the correct validation error.
The outcome is that even the property is validated correctly, there's no red-frame (css error
class) on the appropriate field in the UI.

For reference: http://tapestry.1045711.n5.nabble.com/tapestry-beanvalidation-td4921787.html

  was:
Tapestry-beanvalidator isn't validating nested objects correctly, the problem is that component
parameters i.e. the TextField#value is only bound to the attribute itself but doesn't contain
the full objectpath, so using a DTO like:

class TestDTO {
   @NotNull
   private String firstName;
   @Valid
   private EmbeddedObject embeddedObject;
...
}
class EmbeddedObject {
   @NotNull
   private String lastName;
...
}

Using the TestDTO on a page in the following way:
class MyPage{
...
   @Property
   private TestDTO testDTO;

   @Component(parameters = {"validate=testDTO"})
   private Form form;

   @Component(parameters = {"value=testDTO.firstName"})
   private TextField firstName;

   @Component(parameters = {"value=testDTO.embeddedObject.lastName"})
   private TextField embeddedField;
...
}

Submitting the form validates all the attributes correctly (also the embedded object validation
error is listed in the t:errors component) but when it comes to BeanFieldValidator only lastName
is on the Environment Stack in the BeanValidationContext. As TestDTO doesn't contain the property
lastName and there's no objectpath available it doesn't traverse down the objects and can't
assign the correct validation error.
The outcome is that even the property is validated correctly, there's no red-frame (css error
class) on the appropriate field in the UI.

    
> Tapestry-beanvalidator isn't validating nested DTO objects / Doesn't mark the invalid
fields in the UI
> ------------------------------------------------------------------------------------------------------
>
>                 Key: TAP5-1718
>                 URL: https://issues.apache.org/jira/browse/TAP5-1718
>             Project: Tapestry 5
>          Issue Type: Improvement
>          Components: tapestry-beanvalidator
>    Affects Versions: 5.2.6
>            Reporter: Matthias Melitzer
>              Labels: binding, jsr-303, parameter, tapestry-beanvalidator, validation,
validationdecorator
>
> Tapestry-beanvalidator isn't validating nested objects correctly, the problem is that
component parameters i.e. the TextField#value is only bound to the attribute itself but doesn't
contain the full objectpath, so using a DTO like:
> class TestDTO {
>    @NotNull
>    private String firstName;
>    @Valid
>    private EmbeddedObject embeddedObject;
> ...
> }
> class EmbeddedObject {
>    @NotNull
>    private String lastName;
> ...
> }
> Using the TestDTO on a page in the following way:
> class MyPage{
> ...
>    @Property
>    private TestDTO testDTO;
>    @Component(parameters = {"validate=testDTO"})
>    private Form form;
>    @Component(parameters = {"value=testDTO.firstName"})
>    private TextField firstName;
>    @Component(parameters = {"value=testDTO.embeddedObject.lastName"})
>    private TextField embeddedField;
> ...
> }
> Submitting the form validates all the attributes correctly (also the embedded object
validation error is listed in the t:errors component) but when it comes to BeanFieldValidator
only lastName is on the Environment Stack in the BeanValidationContext. As TestDTO doesn't
contain the property lastName and there's no objectpath available it doesn't traverse down
the objects and can't assign the correct validation error.
> The outcome is that even the property is validated correctly, there's no red-frame (css
error class) on the appropriate field in the UI.
> For reference: http://tapestry.1045711.n5.nabble.com/tapestry-beanvalidation-td4921787.html

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

Mime
View raw message