You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@myfaces.apache.org by "Volodymyr Siedlecki (Jira)" <de...@myfaces.apache.org> on 2023/01/17 20:20:00 UTC

[jira] [Created] (MYFACES-4550) f:validateWholeBean must be placed after all validated fields

Volodymyr Siedlecki created MYFACES-4550:
--------------------------------------------

             Summary: f:validateWholeBean must be placed after all validated fields
                 Key: MYFACES-4550
                 URL: https://issues.apache.org/jira/browse/MYFACES-4550
             Project: MyFaces Core
          Issue Type: Bug
    Affects Versions: 4.0.0-RC3, 3.0.2, 2.3-next-M7, 2.3.10, 2.2.15
            Reporter: Volodymyr Siedlecki


[https://jakarta.ee/specifications/faces/4.0/vdldoc/f/validatewholebean] says: 



 
{noformat}
This tag must be placed in the component tree after all of the fields that are to be included in the multi-field validation. If this precondition is not met, the results of applying this tag are unspecified.{noformat}

I've tested a scenario as so:
{code:java}
    <h:outputText value="Password" />  
    <h:inputSecret id="password1" value='#{backingBean.password1}'>
        <f:validateBean validationGroups="PasswordValidationGroup" />
    </h:inputSecret>

    <f:validateWholeBean value='#{backingBean}' 
        validationGroups="PasswordValidationGroup" />

    <h:outputText value="Password again" /> 
    <h:inputSecret id="password2" value='#{backingBean.password2}'>
        <f:validateBean validationGroups="PasswordValidationGroup" />
    </h:inputSecret> {code}

and found that the values following f:validateWholeBean are not available caused the validation to fail. 

Mojarra throws an exception if the placement is incorrect and as should we. 

It's also part of the TCK: [https://github.com/jakartaee/faces/blob/4.0.1/tck/faces22/multiFieldValidation/src/test/java/ee/jakarta/tck/faces/test/javaee7/multiFieldValidation/Spec1IT.java#L206]

 

 



--
This message was sent by Atlassian Jira
(v8.20.10#820010)