title: How to add Method Expression to a custom JSF component
body: <p>I'm trying to create a custom JSF component and add to it a method expression. This is the code of my custom component:</p>
  
  <pre><code>    @FacesComponent(AjaxCommand2.COMPONENT_TYPE)
  public class AjaxCommand2 extends UIComponentBase {
  
      public static final String COMPONENT_TYPE = "local.test.component.AjaxCommand2";
      public static final String COMPONENT_FAMILY = "local.test.component.AjaxCommand2";
  
      private MethodExpression listener;
  
      public MethodExpression getListener() {
          return listener;
      }
  
      public void setListener(MethodExpression listener) {
          this.listener = listener;
      }
  
  
      @Override
      public String getRendererType() {
          return null;
      }
  
      @Override
      public String getFamily() {
          return COMPONENT_FAMILY;
      }
  }
  </code></pre>
  
  <p>This is my tag lib file:</p>
  
  <pre><code> &lt;?xml version="1.0" encoding="UTF-8"?&gt;
  &lt;facelet-taglib id="test"
                  xmlns="http://java.sun.com/xml/ns/javaee"
                  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
                  xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-facelettaglibrary_2_0.xsd" version="2.0"&gt;
      &lt;namespace&gt;http://local.test/ui&lt;/namespace&gt;
  
      &lt;tag&gt;
          &lt;tag-name&gt;ajaxCommand2&lt;/tag-name&gt;
          &lt;component&gt;
              &lt;component-type&gt;local.test.component.AjaxCommand2&lt;/component-type&gt;
          &lt;/component&gt;
          &lt;attribute&gt;
              &lt;name&gt;listener&lt;/name&gt;
              &lt;required&gt;false&lt;/required&gt;
              &lt;type&gt;javax.el.MethodExpression&lt;/type&gt;
          &lt;/attribute&gt;
      &lt;/tag&gt;
  &lt;/facelet-taglib&gt;
  </code></pre>
  
  <p>And this is the relevant code in the JSF page:</p>
  
  <pre><code>&lt;test:ajaxCommand2 listener="#{testSessionBean.testActionAjax}" /&gt;
  </code></pre>
  
  <p>My problem is that the setter for listener never is called in my custom component and always I'm getting null in listener property.</p>
  
  <p>I cannot see whrere is the problem. 
  Any idea?, I would like set the listener property to point to a specific method of one backed bean.</p>