title: How do I use a MethodExpression with parameters for a custom JSF component?
body: <p>I'm attempting to write a custom JSF tree component which supports adding a listener as an attribute:</p>
  
  <pre><code>&lt;foo:tree value="#{barController.treeNodes}"
                    type="sidenav"
                    onNodeSelect="#{barController.onTreeClick}"&gt;
  &lt;/foo:tree&gt;
  </code></pre>
  
  <p>The listener would take in an event parameter, like so:</p>
  
  <pre><code>public void onTreeClick(TreeSelectEvent event) {}
  </code></pre>
  
  <p>The component class has getters/setters for the Method expression as follows:</p>
  
  <pre><code>/**
   * @return the onNodeSelect
   */
  public MethodExpression getOnNodeSelect() {
      return (MethodExpression ) getStateHelper().eval(PropertyKeys.onNodeSelect);
  }
  
  /**
   * @param onNodeSelect the onNodeSelect to set
   */
  public void setOnNodeSelect(MethodExpression onNodeSelect) {
      getStateHelper().put(PropertyKeys.onNodeSelect, onNodeSelect);
  }
  </code></pre>
  
  <p>However, when I call component.getOnNodeSelect() I get the following error:</p>
  
  <pre><code>Caused by: javax.el.PropertyNotFoundException: /sandbox.xhtml @22,73 onNodeSelect="#   {barController.onTreeClick}": The class 'com.bar.barController$Proxy$_$$_WeldClientProxy' does not have   the property 'onTreeClick'.
   at com.sun.faces.facelets.el.TagValueExpression.getValue(TagValueExpression.java:111)
   at javax.faces.component.ComponentStateHelper.eval(ComponentStateHelper.java:194)
   at javax.faces.component.ComponentStateHelper.eval(ComponentStateHelper.java:182)
  </code></pre>
  
  <p>It seems that JSF is treating my MethodExpression as a ValueExpression instead, and trying to call some getter to find the property. Is there any way I can force it to use a MethodExpression?</p>
  
  <p>I've even tried updating the tag-lib to add a method signature:</p>
  
  <pre><code>&lt;attribute&gt;
          &lt;name&gt;onNodeSelect&lt;/name&gt;
          &lt;description&gt;The listener to be called when a node has been   selected&lt;/description&gt;
          &lt;method-signature&gt;void  process(com.bar.tag.foundation.TreeSelectEvent)&lt;/method-signature&gt;
          &lt;type&gt;javax.el.MethodExpression&lt;/type&gt;
  &lt;/attribute&gt;
  </code></pre>
  
  <p>Any help would be greatly appreciated! </p>