通方法表达通过嵌套复合部件属性(Pass method expression attribute t

2019-10-22 05:36发布

我有复合成分DocumentSelector ,其中包含另一个复合材料部件modalWindow

<cc:interface componentType="selector.DocumentSelector">
     <cc:attribute name="showSelector"
              method-signature="void listener(java.util.List)"/>
</cc:interface>

<cc:implementation>

    <div id="#{cc.clientId}">
        <ccs:modalWindow id="modal_window" showListener="#{cc.showSelector}"
                     mode="ajax">

        </ccs:modalWindow>
    </div>
</cc:implementation>

我需要方法通过#{cc.showSelector}到复合部件modalWindow从面孔部件DocumentSelector 。 但我有PropertyNotFoundException因为ElResolver#{cc}modalWindow组件,而不是DocumentSelector

modalWindow组件:

<cc:interface componentType="statistics.ModalWindow">
    <cc:attribute name="showListener" method-signature="void show()"/>
    <cc:attribute name="hideListener" method-signature="void hide()"/>
</cc:interface>
<cc:implementation>
</cc:implementation> 

我使用Java EE 7,JSF 2.2,WildFly 8.2.0

Answer 1:

使用<cc:attribute targets>的属性基本上移动到指定的组件,并使用必要时<cc:attribute targetAttributeName>进行重命名。

<cc:attribute ... targets="modal_window" targetAttributeName="showListener" />

不要忘了删除showListener="#{cc.showSelector}"



文章来源: Pass method expression attribute through to nested composite component