Tapestry 5
  1. Tapestry 5
  2. TAP5-2101

BeanEditor should always provide a new BeanValidationContext (JSR-303)

    Details

    • Type: Bug Bug
    • Status: Resolved
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: 5.3.7, 5.4
    • Component/s: tapestry-beanvalidator
    • Labels:
      None

      Description

      We found that the current BeanEditor implementation:

      • fails to beanvalidate (JSR-303) complex beans (beans that contain other beans)
      • fails to validate more than one bean in the same page (when more than one BeanEditor is present in teh page)

      The problem is that BeanEditor doesn't provide the correct BeanValidationContext to the validation framework.

      Given the following beans:

      public class ComplexBean

      { private SomeSimpleBean someSimpleBean; @NotNull private String simpleNotNullProperty; ... }

      public class SimpleBean

      { @Min(6) private int minValue; .. }

      One would expect that the following page would validate all the constraint from both ComplexBean and SimpleBean:
      <t:form validate="complexBean">
      <t:BeanEditor object="complexBean" />
      <t:BeanEditor object="complexBean.someSimpleBean" />
      ...

      Instead only ComplexBean.simpleNotNullProperty constraint is validated.

      Moreover not even:
      <t:form validate="this">
      <t:BeanEditor object="beanA" />
      <t:BeanEditor object=" beanB " />
      <t:form/>

      Is (bean)validating properly....

      BeanEditor should provide the validation framework with a new BeanValidationContext bound to the object being validated all the times.

      1. TAP5-2101-2.patch
        4 kB
        Alejandro Scandroli
      2. beaneditor-jsr303.patch
        8 kB
        Luca Menegus

        Activity

        No work has yet been logged on this issue.

          People

          • Assignee:
            Kalle Korhonen
            Reporter:
            Luca Menegus
          • Votes:
            4 Vote for this issue
            Watchers:
            6 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Development