将方法表达式属性传递给嵌套的复合组件 [英] Pass method expression attribute through to nested composite component

查看:123
本文介绍了将方法表达式属性传递给嵌套的复合组件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有复合组件DocumentSelector,其中包含另一个复合组件modalWindow.

I have composite component DocumentSelector, which contains another composite component 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}从面组件DocumentSelector传递到复合组件modalWindow.但是我有PropertyNotFoundException 因为ElResolver#{cc}modalWindow组件而不是DocumentSelector

I need to pass method #{cc.showSelector} to composite component modalWindow from faces component DocumentSelector. But I have PropertyNotFoundException because ElResolver associate #{cc} with modalWindow component instead of DocumentSelector

modalWindow组件:

modalWindow component:

<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

I use Java EE 7, JSF 2.2, WildFly 8.2.0

推荐答案

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

Use <cc:attribute targets> to basically move the attribute to the specified component and use if necessary <cc:attribute targetAttributeName> to rename it.

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

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

这篇关于将方法表达式属性传递给嵌套的复合组件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆