gpt4 book ai didi

jsf-2 - 为 f :metadata 创建复合组件

转载 作者:行者123 更新时间:2023-12-01 12:51:45 25 4
gpt4 key购买 nike

我想创建一个复合组件,将一些通用元数据添加到 View 中,例如:

<viewController:metadata controller="orderController"/>

组件:

<composite:interface>
<composite:attribute name="controller" />
</composite:interface>

<composite:implementation>

<f:metadata>
<f:viewParam name="id" value="#{cc.attrs.controller.id}" />
<f:event type="preRenderView"
listener="#{cc.attrs.controller.initConversation}" />
</f:metadata>

</composite:implementation>

我做了类似的事情来为所有 View 添加一个按钮栏并且它工作正常,但它似乎不可能与 f:metadata 一起使用。

我是对的还是我的代码有问题?

谢谢

最佳答案

这是不可能的。 <f:metadata>必须进入与 View ID 关联的 View 。另见 tag documentation (强调我的):

Declare the metadata facet for this view. This must be a child of the <f:view>. This tag must reside within the top level XHTML file for the given viewId, or in a template client, but not in a template. The implementation must insure that the direct child of the facet is a UIPanel, even if there is only one child of the facet. The implementation must set the id of the UIPanel to be the value of the UIViewRoot.METADATA_FACET_NAME symbolic constant.

关于jsf-2 - 为 f :metadata 创建复合组件,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/11971927/

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