gpt4 book ai didi

JSF 2.0 : Passing composite component attribute to inner composite component

转载 作者:行者123 更新时间:2023-12-01 05:42:34 26 4
gpt4 key购买 nike

我有以下情况:

<cc:interface>
<cc:attribute name="someValue" />
</cc:interface>

<cc:composite>
<x:someComponent>
<span>#{cc.attrs.someValue}</span>
</x:someComponent>
</cc:composite>

因此,在我的复合组件中,我正在调用其他一些复合组件,并尝试将提供给“主”复合组件的参数传递给内部复合组件。

这失败了,因为在 x:someComponent 里面标记 cc隐式对象似乎指的是这个 x:someComponent反而。

解决方法是为 x:someComponent 创建一个临时字段。所以这可以实现为:
<x:someComponent passthroughField="#{cc.attrs.someValue}">
<span>#{cc.attrs.passthroughField}</span>
</x:someComponent>

然而,这是非常丑陋和不方便的。

有其他方法可以解决这个问题吗?

最佳答案

解决此问题的一种方法是使用 ui:param如:

<ui:param name="foo" value="cc.attrs.someValue" />
<x:someComponent>
<span>#{foo}</span>
</x:someComponent>

查看更多 another question .

关于JSF 2.0 : Passing composite component attribute to inner composite component,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/4585680/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com