Search code examples
jsf-2bean-validationhibernate-validatorjsf-2.2

Bean-Validation not working under JSF2.2 (Majorra 2.2.5)


after upgrading from Majorra 2.1.27 to 2.2.5 my Bean-Validation stopped working. Simple example:

<h:form>
    <h:outputLabel for="tf_name" />
    <h:inputText id="tf_name" value="#{test.testEntity.name}" />
    <h:message for="tf_name" />
    <br />
    <h:commandButton value="save" action="#{test.cantTouchThis}"/>
</h:form>

The field "name" on my TestEntity is annotated with @NotNull (and i have set INTERPRET_EMPTY_STRING_SUBMITTED_VALUES_AS_NULL to true in web.xml +org.apache.el.parser.COERCE_TO_ZERO to false for my tomcat).

If i use Majorra 2.1.27 (i use maven btw.) everything works fine. But if i switch to 2.2.5 my Method cantTouchThis() is called, even when i leave the fields empty. I also tried with other validators, none of them seem to work. Validation is skipped completely.

any ideas?


Solution

  • As tipped by lu4242 this was a bug in Mojarra. The bug emerged in version 2.2.3 and is fixed with 2.2.7 (which at the time of writing this is not officially released).

    See JAVASERVERFACES-3183 for more details.