title: Adding action methods to a composite component
body: <p>I am learning about composite components with JSF 2.0 and i want my component to be able to trigger methods from backing beans, so i created a simple example, but something is wrong.</p>
  
  <p><strong>This is the component i created:</strong></p>
  
  <pre><code>&lt;html xmlns="http://www.w3.org/1999/xhtml"
      xmlns:h="http://java.sun.com/jsf/html"
  xmlns:composite="http://java.sun.com/jsf/composite"&gt;
  
  &lt;composite:interface&gt;
          &lt;composite:attribute name="attribute1"/&gt;
          &lt;composite:attribute name="attribute2"/&gt;
          &lt;composite:attribute name="actionBtnText"/&gt;
          &lt;composite:attribute name="actionMethod" method-signature="java.lang.String action()"/&gt;
  &lt;/composite:interface&gt;
  
  &lt;composite:implementation&gt;
      &lt;h:form&gt;
              &lt;h:inputText value="#{cc.attrs.attribute1}"/&gt;
              &lt;br/&gt;
              &lt;h:inputText value="#{cc.attrs.attribute2}"/&gt;
              &lt;br/&gt;
              &lt;h:commandButton action="#{cc.attrs.actionMethod}" value="#{cc.attrs.actionBtnText}"/&gt;          
      &lt;/h:form&gt;
  
  &lt;/composite:implementation&gt; 
  
  &lt;/html&gt;
  </code></pre>
  
  <p><strong>This is how i use it in a JSF page</strong></p>
  
  <pre><code>&lt;html xmlns="http://www.w3.org/1999/xhtml"
      xmlns:ui="http://java.sun.com/jsf/facelets"
      xmlns:h="http://java.sun.com/jsf/html"
      xmlns:f="http://java.sun.com/jsf/core"
      xmlns:custom="http://java.sun.com/jsf/composite/custom"&gt;
  
  ...
  
      &lt;h:body&gt;
      &lt;custom:demoCustomComponent attribute1="#{demoBB.value1 }" attribute2="#{demoBB.value2 }" actionBtnText="Button text!" actionBtn="#{demoBB.act}"/&gt;
      &lt;/h:body&gt;
  </code></pre>
  
  <p><strong>And this is the backing bean that gives support to the page where the component is</strong></p>
  
  <pre><code>@Named("demoBB")
  @RequestScoped
  public class DemoBB {
  
      private String value1;
      private String value2;
      public String getValue1() {
          return value1;
      }
  
      public String act() {
          System.out.println("Input 1: " + value1 + "\nInput 2: " + value2);
          return null;
      }
  
      //Getters and setters
      public void setValue1(String value1) {
          this.value1 = value1;
      }
      public String getValue2() {
          return value2;
      }
      public void setValue2(String value2) {
          this.value2 = value2;
      }   
  }
  </code></pre>
  
  <p>The component seems to render fine, but when i press the button i get an exception that says: </p>
  
  <blockquote>
    <p>javax.faces.FacesException: Unable to resolve composite component from
    using page using EL expression '#{cc.attrs.actionMethod}'</p>
  </blockquote>
  
  <p>Did i make any mistake in the interface or implementation of the component? Why doesn't work?</p>