You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tapestry.apache.org by mem <me...@gmail.com> on 2011/10/20 17:09:16 UTC

tapestry-beanvalidation

We'd like to use JSR-303 bean validation and mark invalid fields in the UI.
The Tapestry  beanvalidation module already does quite a good job but has a
minor bug when it comes to embedded objects. 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.

--
View this message in context: http://tapestry.1045711.n5.nabble.com/tapestry-beanvalidation-tp4921787p4921787.html
Sent from the Tapestry - User mailing list archive at Nabble.com.

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org


Re: tapestry-beanvalidation

Posted by Igor Drobiazko <ig...@gmail.com>.
Please fill a JIRA issue.

20.10.2011, в 17:09, mem <me...@gmail.com> написал(а):

> We'd like to use JSR-303 bean validation and mark invalid fields in  
> the UI.
> The Tapestry  beanvalidation module already does quite a good job  
> but has a
> minor bug when it comes to embedded objects. 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.
>
> --
> View this message in context: http://tapestry.1045711.n5.nabble.com/tapestry-beanvalidation-tp4921787p4921787.html
> Sent from the Tapestry - User mailing list archive at Nabble.com.
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> For additional commands, e-mail: users-help@tapestry.apache.org
>

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org