2016-02-29 71 views
0

解決複合材料構件我研究了一些類似的問題在這裏計算器,但他們都不釘我的問題......JSF複合組件:無法使用頁面使用EL表達式

我寫了一個(一種簡單的)複合組成:

<html xmlns="http://www.w3.org/1999/xhtml" 
    xmlns:h="http://java.sun.com/jsf/html" 
    xmlns:f="http://java.sun.com/jsf/core" 
    xmlns:composite="http://java.sun.com/jsf/composite"> 

<composite:interface> 

    <composite:attribute name="buttonValue" /> 
    <composite:attribute name="ajaxExecute" /> 
    <composite:attribute name="ajaxRender" /> 
    <composite:attribute name="ajaxListener" /> 

</composite:interface> 


<composite:implementation> 

    <h:commandButton value="#{cc.attrs.buttonValue}"> 
     <f:ajax execute="#{cc.attrs.ajaxExecute}" 
      render="#{cc.attrs.ajaxRender}" listener="#{cc.attrs.ajaxListener}" /> 
    </h:commandButton> 

</composite:implementation> 

</html> 

,其中包括此一進我的看法,像這樣:

<my:ajaxCommandButton 
       buttonValue="foo" 
       ajaxExecute="" 
       ajaxRender="" 
       ajaxListener="#{viewBacking.resend()}"></my:ajaxCommandButton> 

有趣的是 - 這傢伙就像一個冠軍() - 每當我CL的時間!在它上面,豆的方法被調用,並且都似乎很棒。

不幸的是我得到這個東西登出與按鈕每次點擊:有一個想法,我

20160229:143610.598 [http-/0.0.0.0:8080-2] WARNING javax.enterprise.resource.webcontainer.jsf.lifecycle - Unable to resolve composite component from using page using EL expression '#{cc.attrs.ajaxListener}': javax.faces.FacesException: Unable to resolve composite component from using page using EL expression '#{cc.attrs.ajaxListener}' 
    at com.sun.faces.facelets.tag.TagAttributeImpl$AttributeLookupMethodExpression.invoke(TagAttributeImpl.java:444) [jsf-impl-2.1.28.redhat-8.jar:2.1.28.redhat-8] 
    at com.sun.faces.facelets.tag.jsf.core.AjaxBehaviorListenerImpl.processAjaxBehavior(AjaxHandler.java:447) [jsf-impl-2.1.28.redhat-8.jar:2.1.28.redhat-8] 
    at javax.faces.event.AjaxBehaviorEvent.processListener(AjaxBehaviorEvent.java:113) [jboss-jsf-api_2.1_spec-2.1.28.Final-redhat-1.jar:2.1.28.Final-redhat-1] 
    at javax.faces.component.behavior.BehaviorBase.broadcast(BehaviorBase.java:106) [jboss-jsf-api_2.1_spec-2.1.28.Final-redhat-1.jar:2.1.28.Final-redhat-1] 
    at javax.faces.component.UIComponentBase.broadcast(UIComponentBase.java:762) [jboss-jsf-api_2.1_spec-2.1.28.Final-redhat-1.jar:2.1.28.Final-redhat-1] 
    at javax.faces.component.UICommand.broadcast(UICommand.java:300) [jboss-jsf-api_2.1_spec-2.1.28.Final-redhat-1.jar:2.1.28.Final-redhat-1] 
    at javax.faces.component.UIViewRoot.broadcastEvents(UIViewRoot.java:786) [jboss-jsf-api_2.1_spec-2.1.28.Final-redhat-1.jar:2.1.28.Final-redhat-1] 
    at javax.faces.component.UIViewRoot.processApplication(UIViewRoot.java:1251) [jboss-jsf-api_2.1_spec-2.1.28.Final-redhat-1.jar:2.1.28.Final-redhat-1] 
    at com.sun.faces.lifecycle.InvokeApplicationPhase.execute(InvokeApplicationPhase.java:81) [jsf-impl-2.1.28.redhat-8.jar:2.1.28.redhat-8] 
    at com.sun.faces.lifecycle.Phase.doPhase(Phase.java:101) [jsf-impl-2.1.28.redhat-8.jar:2.1.28.redhat-8] 
    at com.sun.faces.lifecycle.LifecycleImpl.execute(LifecycleImpl.java:118) [jsf-impl-2.1.28.redhat-8.jar:2.1.28.redhat-8] 
    at javax.faces.webapp.FacesServlet.service(FacesServlet.java:593) [jboss-jsf-api_2.1_spec-2.1.28.Final-redhat-1.jar:2.1.28.Final-redhat-1] 
[...] 
20160229:143610.600 [http-/0.0.0.0:8080-2] SEVERE javax.enterprise.resource.webcontainer.jsf.context - javax.faces.FacesException: Unable to resolve composite component from using page using EL expression '#{cc.attrs.ajaxListener}' 
    at com.sun.faces.facelets.tag.TagAttributeImpl$AttributeLookupMethodExpression.invoke(TagAttributeImpl.java:444) 
    at com.sun.faces.facelets.tag.jsf.core.AjaxBehaviorListenerImpl.processAjaxBehavior(AjaxHandler.java:447) 
    at javax.faces.event.AjaxBehaviorEvent.processListener(AjaxBehaviorEvent.java:113) 
    at javax.faces.component.behavior.BehaviorBase.broadcast(BehaviorBase.java:106) 
    at javax.faces.component.UIComponentBase.broadcast(UIComponentBase.java:762) 
    at javax.faces.component.UICommand.broadcast(UICommand.java:300) 
    at javax.faces.component.UIViewRoot.broadcastEvents(UIViewRoot.java:786) 
    at javax.faces.component.UIViewRoot.processApplication(UIViewRoot.java:1251) 
    at com.sun.faces.lifecycle.InvokeApplicationPhase.execute(InvokeApplicationPhase.java:81) 
    at com.sun.faces.lifecycle.Phase.doPhase(Phase.java:101) 
    at com.sun.faces.lifecycle.LifecycleImpl.execute(LifecycleImpl.java:118) 
    at javax.faces.webapp.FacesServlet.service(FacesServlet.java:593) 

有人嗎?提前感謝!

+0

非常感謝提示。這真是訣竅! – Stephan

+0

我轉發評論作爲答案 - 很高興它幫助。 – Nikola

回答

0

只是一個想法 - 添加「方法簽名」屬性<composite:attribute name="ajaxListener" />