ValidateBean doesn't update values provided by Composite Components #240

CSchulz opened this Issue Apr 19, 2016 · 4 comments


None yet

2 participants

CSchulz commented Apr 19, 2016 edited

Consider following component in template

        <r:booleanCheckbox value="#{controller.entity.value}" />

and the following composite component:

<?xml version='1.0' encoding='UTF-8' ?>
<!DOCTYPE html>
<html xmlns=""

    <cc:attribute name="value" required="true" />

    <div id="#{cc.clientId}">
      <div class="form-element-input">
        <p:selectBooleanCheckbox id="checkbox" value="#{cc.attrs.value}" >
          <cc:insertChildren />

The ValidateBean class doesn't recognize it as valid property in if (valueReference.getBase().equals(base)) { (source). In my case the base is the nestd ExpressionEvalMap class of CompositeComponentAttributesELResolver (Mojarra).

I think the ValidateBean class should recognize CompositeComponent properties and dive through all "value" attributes.

f.e. in my case the following resolution will work:

if (getValueReference(context.getELContext(), valueReference.getBase().getExpression("value")).equals(base))}

If someone has some ideas how to fix it, I would prepare a pull request.

@BalusC BalusC closed this in f0ca9d9 Apr 28, 2016
BalusC commented Apr 28, 2016

Fix is available in today's latest 2.4-SNAPSHOT. Can you give it a try and let me know?

CSchulz commented Apr 28, 2016 edited

It seems there is a regression bug now (see #144)

21:40:48,693 SEVERE [org.omnifaces.taghandler.ValidateBean] (default task-106) Exception occured while doing validation.: java.lang.IllegalArgumentException: Cannot convert org.omnifaces.el.ExpressionInspector$FinalBaseHolder@ed5de7f of type class org.omnifaces.el.ExpressionInspector$FinalBaseHolder to class java.lang.Boolean
    at com.sun.el.lang.ELSupport.coerceToBoolean( [javax.el-3.0.1-b05.jar:]
    at com.sun.el.parser.AstChoice.getValue( [javax.el-3.0.1-b05.jar:]
    at com.sun.el.ValueExpressionImpl.getValue( [javax.el-3.0.1-b05.jar:]
    at org.jboss.weld.el.WeldValueExpression.getValue( [weld-core-impl-2.2.6.Final.jar:2014-10-03 10:05]
    at org.jboss.weld.el.WeldValueExpression.getValue( [weld-core-impl-2.2.6.Final.jar:2014-10-03 10:05]
    at com.sun.faces.facelets.el.TagValueExpression.getValue( [jsf-impl-2.2.8-jbossorg-1.jar:]
    at org.omnifaces.el.ExpressionInspector.getValueReference( [omnifaces-2.4-20160428.144047-7.jar:2.4-SNAPSHOT]
    at org.omnifaces.el.ExpressionInspector.getValueReference( [omnifaces-2.4-20160428.144047-7.jar:2.4-SNAPSHOT]
    at org.omnifaces.taghandler.ValidateBean$6.invoke( [omnifaces-2.4-20160428.144047-7.jar:2.4-SNAPSHOT]
    at org.omnifaces.taghandler.ValidateBean$6.invoke( [omnifaces-2.4-20160428.144047-7.jar:2.4-SNAPSHOT]
    at org.omnifaces.util.Components$ForEach$1.visit( [omnifaces-2.4-20160428.144047-7.jar:2.4-SNAPSHOT]

It seems not to be related, it happens for following composite component:

                         value="#{controller.create ? null : schadenController.entity.value}"
                         disabled="#{controller.create}" />
BalusC commented Apr 30, 2016 edited

That's not a valid writable value expression in first place. Outside the composite, you'd face a PropertyNotWritableException on submit. Just use value="#{schadenController.entity.value}".

CSchulz commented Apr 30, 2016

Not real part of the issue, it is value="#{schadenController.entity.embeddable.value}" in my case, but it throw a PNWE because the embeddable doesn't exists.
The idea is for this use case to disable all fields and set the value to null, because it isn't writable.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment