JSF 复合:insertFacet 和复合:renderFacet
我想要一个带有方面的复合组件,我在这个复合组件的“实现”中实现了它。我的问题是 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 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
只是为了澄清:
您是否指定了在组件的接口内?
此外,您在另一个地方到底是什么意思?
一些提示:
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:
我成功了。问题是我必须找出插入的方面的 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: