问题描述
我有复合组件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}"
.
这篇关于将方法表达式属性传递给嵌套的复合组件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!