1
votes

In my web.xml, I have this configuration entry:

<context-param>
   <param-name>javax.faces.validator.DISABLE_DEFAULT_BEAN_VALIDATOR</param-name>
   <param-value>true</param-value>
</context-param>

However, I don't want it to be always true. I want to set it true or false in my managed bean, depending on the situation. Is that possible?

1
I rollbacked your edit. You should not reuse an existing question for a new question. You should ask a new question as a new question. Your initial problem has been solved. - BalusC
right, gonna set your answer as accepted, it is really a problem in hibernate validator... I found a simple solution for my case, it was just set my field with disabled=true, this way it won't fire the validation from the bean. Thanks for all your help. - Mateus Viccari

1 Answers

5
votes

No, that's the wrong way of solving the concrete problem. For that, the <f:validateBean> tag should actually be used instead.

You can use it on a per-view or per-form basis, most self-documenting would be to just wrap it around the <h:form>. The <h:form> in turn can be just in a template client (and the <f:validateBean> thus in the master template).

<f:validateBean disabled="true">
    <h:form>

    </h:form>
</f:validateBean>

You can even use EL in there.

<f:validateBean disabled="#{settings.beanValidationDisabled}">