Uploaded image for project: 'MyFaces Core'
  1. MyFaces Core
  2. MYFACES-2528

BeanValidator validation groups are overwritten with PSS

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Resolved
    • Major
    • Resolution: Implemented
    • 2.0.0-beta
    • None
    • JSR-314
    • None

    Description

      Setting the validation groups of a bean validator like <f:validateBean validationGroups="#

      {bean.groups}"/> is not always working correctly with PSS. Property bean.groups returns null or the class name of a validation group in my example based on the value of a boolean checkbox:

      <h:selectBooleanCheckbox value="#{bean.prop1}"
      valueChangeListener="#{bean.prop1Changed}"
      immediate="true" onclick="this.form.submit()"/>
      <h:inputText value="#{bean.prop2}" rendered="#{bean.prop1}">
      <f:validateBean validationGroups="#{bean.groups}

      "/>
      </h:inputText>

      If I check the boolean checkbox the form is submitted and rendered again with the additional input field. The problem now is that the validation groups are set correctly on building the view during the second traversal of the lifecycle before restoring the state. But on restoring the validator this value is overwritten with the old value from the state and my validation group is gone again.

      As the BeanValidator is a PartialStateHolder this can be avoided by only saving and restoring the state if the initial state was not marked.

      Attachments

        1. MYFACES-2528.patch
          1.0 kB
          Michael Kurz

        Activity

          People

            Unassigned Unassigned
            dr.gonzo Michael Kurz
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: