JSF 复合:insertFacet 和复合:renderFacet

发布于 2024-10-21 12:42:45 字数 688 浏览 5 评论 0原文

我想要一个带有方面的复合组件,我在这个复合组件的“实现”中实现了它。我的问题是 ids,因为当我只在复合组件中定义然后将我的实现放入其中时,它只会呈现它,但组件位于另一个位置。 以下是示例代码:

myComposition.xhtml

<composite:implementation>
 <composite:renderFacet name="myFacet">
</composite:implementation>

myCompositionImpl.xhtml

<mySomething:myComposition>
 <f:facet name="myFacet">
  this code is rendered but the "component" which I define here is not placed 
  logically in the place where I defined the "renderFacet". 
 </f:facet>
</mySomething:myComposition>

我该怎么办?使用composite:insertFacet它不会渲染任何东西。我还需要该组件,因为我需要知道它的客户端 ID。

I want to have a composite component with a facet in it, which I implement in my "implementation" of this composite component. My problem are ids, because when I only define in my composite component and then with put my implementation in it, it only renders it but the component is in another place.
Here is a sample code:

myComposition.xhtml

<composite:implementation>
 <composite:renderFacet name="myFacet">
</composite:implementation>

myCompositionImpl.xhtml

<mySomething:myComposition>
 <f:facet name="myFacet">
  this code is rendered but the "component" which I define here is not placed 
  logically in the place where I defined the "renderFacet". 
 </f:facet>
</mySomething:myComposition>

What can I do about this? With composite:insertFacet it doesn't render anything. I need to have the component also there because I need to know the client id of it.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

宣告ˉ结束 2024-10-28 12:42:45

只是为了澄清:

您是否指定了在组件的接口内?

此外,您在另一个地方到底是什么意思?

一些提示:

  • renderFacet 是正确的,insertFacet 适用于复合本身内定义的面。
  • 尝试添加“”作为构面内容的第一行,这应该是有关单行构面内容的错误的解决方法。

Just to clarify:

Did you specify <cc:facet name="myFacet"> within the interface of the component?

Furthermore what exactly do you mean with in another place?

Some tips:

  • renderFacet is correct, insertFacet is for facets defined within the composite itself.
  • Try adding "<!-- -->" as the first line of content of your facet, this suppose to be a workaround for a bug regarding single line facet content.
弃爱 2024-10-28 12:42:45

我成功了。问题是我必须找出插入的方面的 clientId,并且我不知道每个复合组件都有自己的 NamingContainer。

我有类似的事情:
“myComposition2.xhtml”

...

“索引.faces”

生成的 clientId 为:myC2:myC1:

I got it working. The problem was I had to figure out the clientId of the facet inserted and I didn't know that each composite-component makes it own NamingContainer.

I had something like that:
"myComposition2.xhtml"

...

"index.faces"

and the resulting clientId was: myC2:myC1:

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文