I am using JSF 2.0 btw
I have an attribute X type Integer, that has default value 0. In my JSF page, I create a component that I want it to be disabled if X is 0, and enabled otherwise.
<h:selectBooleanCheckbox disabled="#{X}"/>
and I got this error
Cannot convert 0 of type class java.lang.Integer to class java.lang.Boolean
Your question is pretty vague and ambiguous. I don’t see how a converter is useful here. A converter is mere to convert between a non-standard type and
Stringtype (the standard types for which EL has builtin conversions (coercions) are primitives,NumberandBoolean). Also, I think that you actually meant “rendered in component tree” when you said “disabled” and “enabled”.In a nut, you basically want
<h:someComponent rendered="#{X != 0}" />.Can’t you just do that?