複合コンポーネントとアクション メソッドを含む myfaces 2.1.10 (TomEE にパッケージ化) で奇妙な問題が発生しています。基本的に、以下の例を見ると、myfaces はアクション メソッドが代わりにプロパティであり、ElException をスローしているように見えます。この同じコードは、Mojarra (jBoss 7.1.2 の下) で正常に動作します。
私が間違っていることは何か分かりますか?
例外:
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: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>
次のページは上記のコンポーネントを使用しています
<h:head>
</h:head>
<h:body>
<menu:menu action="#{someBean.act}"/>
</h:body>
</html>
アクション メソッドを持つバッキング Bean
package com.company.dept.beans;
import javax.inject.Named;
@Named
public class SomeBean {
public String act() {
System.out.println("ACT CALLED");
return "SUCCESS";
}
}