JSF ui:insertChildren 当组件位于同一项目中时正常,当组件位于 taglib 中时失败
我有一个相当简单的 JSF 组件:
<composite:interface>
</composite:interface>
<composite:implementation>
<mytaglib:jquery-ui/>
<h:outputScript target="head" library="com.mytaglib.mytaglib" name="dockwidget/dockwidget.js"/>
<f:subview>
<div id="${component.clientId}_div">
<composite:insertChildren/>
</div>
<script>
$(document).ready(function() {
setTimeout("$(document.getElementById('${component.clientId}_div')).dockWidget();", 50);
});
</script>
</f:subview>
我已将其包含在 taglib jar(在 Eclipse 中链接的 Maven 项目)中,并在 mytaglib.taglib.xml 中包含所需条目。当我以这种方式使用它时, insertChildren 似乎没有拾取孩子。其他一切都呈现良好 - 包括测试“Hello World”(如果我将其插入控件中的 div 中)。
如果我获取 xhtml 文件并将其放在 resources/localcontrols 下,并在我的 page.xhtml 中引用该副本,它就会工作并且包含子组件。
这是正常的吗?
谢谢 - Richard
(顺便说一句 - setTimeout 因为我的布局 javascript 运行得太早 - 在子组件完全渲染之前。我想知道 JQuery 是否有办法正确解决这个问题。)
I have a fairly simple JSF component:
<composite:interface>
</composite:interface>
<composite:implementation>
<mytaglib:jquery-ui/>
<h:outputScript target="head" library="com.mytaglib.mytaglib" name="dockwidget/dockwidget.js"/>
<f:subview>
<div id="${component.clientId}_div">
<composite:insertChildren/>
</div>
<script>
$(document).ready(function() {
setTimeout("$(document.getElementById('${component.clientId}_div')).dockWidget();", 50);
});
</script>
</f:subview>
I've included that in a taglib jar (maven project linked in Eclipse) with the required entry in the mytaglib.taglib.xml. When I use it this way then the insertChildren does not seem to pick up the children. Everything else renders fine - including a test "Hello World" if I insert it into the div in the control.
If I take the xhtml file and place it under resources/localcontrols and refer to that copy in my page.xhtml it works and the child components are included.
Is this normal?
Thanks
- Richard
(As an aside - the setTimeout because my layout javascript was running too early - before the child components had been fully rendered. I wonder if JQuery has a way of solving this properly.)
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论