2017-04-18 3 views
0

我々はJSF 2.2プロジェクト(コードを明確にするために簡略化されている)、このように使用される複合コンポーネントである:WildflyでF:複合コンポーネントでAJAXリスナーがWildFlyに動作を停止10

<!-- the page with the composite component inside --> 
<my:component methodListener="#{myBean.myMethod}" /> 

<!-- the composite component --> 
<cc:interface> 
    <cc:attribute name="methodListener" required="true" method-signature="void listener(javax.faces.event.AjaxBehaviorEvent)" /> 
    ... 
<cc:implementation> 
    <h:commandLink> 
     <f:ajax listener="#{cc.attrs.methodListener}" /> 
     <f:attribute name="myAttribute" value="myValue" /> 
    </h:commandLink> 
// the called method 
public void myMethod(AjaxBehaviorEvent event) 
{ 
    System.out.println("> " + event); 
} 

9.0.2では、複合コンポーネント内のcommandLinkをクリックすると、myMethodが呼び出され、イベントが定義されます(myAttributeの値を見つけることができます)。

Wildfly 10.1.0では、正確に同じコードでmyMethodが呼び出されましたが、イベントパラメータは常にnullです。

ここで何か間違っていますか?

テスト済みの回避策は、methodListener CC属性を次のコードのようなBeanインスタンスに置き換えることです。それでも、これは私たちのプロジェクトに多くの置き換えが必要なので、この解決法を避けたいと思います。

<!-- the workaround composite component --> 
<cc:interface> 
    <cc:attribute name="methodBean" required="true" type="com.example.myBean" /> 
... 
<cc:implementation> 
    <h:commandLink> 
     <f:ajax listener="#{cc.attrs.methodBean.myMethod}" /> 
     <f:attribute name="myAttribute" value="myValue" /> 
    </h:commandLink> 

答えて

0

まあ、私は別の関連質問にBalusCからthis answerを見ていません。

<!-- the CC xhtml --> 
<h:commandLink> 
    <f:ajax listener="#{cc.methodListener}" /> 
    <f:attribute name="myAttribute" value="myValue" /> 
</h:commandLink> 
// the CC implementation 
public void methodListener(AjaxBehaviorEvent event) 
{ 
    FacesContext context = getCurrentInstance(); 
    MethodExpression ajaxEventListener = (MethodExpression) getAttributes().get("methodListener"); 
    ajaxEventListener.invoke(context.getELContext(), new Object[] { event }); 
} 
:私のコードはWF9に勤務し、WF10で破ったが、ここでは、コンポーネントそのものではなく、何かを変更する必要はありません簡単な解決策、だからこそ私はまだ理解していません
関連する問題