I'm running into an odd issue with myfaces 2.1.10 (packaged with TomEE) involving composite components and action methods. Essentially, looking at the example below, myfaces seems to thing that the action method is a property instead and throws an ElException. This same code works fine with Mojarra (under jBoss 7.1.2).
Any idea what I'm doing wrong?
Exception:
javax.el.ELException: /index.xhtml: Property 'act' not found on type com.company.dept.beans.SomeBean
org.apache.myfaces.view.facelets.compiler.AttributeInstruction.write(AttributeInstruction.java:55)
org.apache.myfaces.view.facelets.compiler.UIInstructions.encodeBegin(UIInstructions.java:46)
org.apache.myfaces.view.facelets.compiler.UILeaf.encodeAll(UILeaf.java:505)
javax.faces.component.UIComponentBase.encodeAll(UIComponentBase.java:541)
javax.faces.component.UIComponentBase.encodeAll(UIComponentBase.java:541)
org.apache.myfaces.view.facelets.FaceletViewDeclarationLanguage.renderView(FaceletViewDeclarationLanguage.java:1981)
org.apache.myfaces.application.ViewHandlerImpl.renderView(ViewHandlerImpl.java:285)
javax.faces.application.ViewHandlerWrapper.renderView(ViewHandlerWrapper.java:59)
org.apache.myfaces.lifecycle.RenderResponseExecutor.execute(RenderResponseExecutor.java:116)
org.apache.myfaces.lifecycle.LifecycleImpl.render(LifecycleImpl.java:241)
javax.faces.webapp.FacesServlet.service(FacesServlet.java:199)
Composite component named "menu":
<composite:interface displayName="Navigation Menu Bar" shortDescription="Navigation menu bar">
<composite:attribute name="action" method-signature="java.lang.String action()"/>
</composite:interface>
<composite:implementation>
<div id="#{cc.clientId}:menuComponent">
<h:form>
<h:commandButton action="#{cc.attrs.action}" value="execute action" />
</h:form>
</div>
</composite:implementation>
The following page uses the component above
<h:head>
</h:head>
<h:body>
<menu:menu action="#{someBean.act}"/>
</h:body>
</html>
The backing bean with the action method
package com.company.dept.beans;
import javax.inject.Named;
@Named
public class SomeBean {
public String act() {
System.out.println("ACT CALLED");
return "SUCCESS";
}
}