繁体   English   中英

JSF Composite Component:无法通过使用EL表达式使用页面来解析复合组件

[英]JSF Composite Component: Unable to resolve composite component from using page using EL expression

我在这里研究了一些关于stackoverflow的类似问题,但是似乎没有一个问题解决了我的问题。

我写了(一种简单的)复合组件:

<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>

有趣的是-这个家伙的工作就像冠军(!)-每次我单击它时,都会调用bean方法,而且一切似乎都很棒。

不幸的是,每单击一次按钮,我都会注销以下内容:

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)

有人对我有想法吗? 在此先多谢!

只是一个想法-将“ method-signature”属性添加到<composite:attribute name="ajaxListener" />

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM