添加一次小部件(widget.xhtml)的代码,但在同一网页中使用它两次,可能吗?如何?
我的应用程序中有一个小部件,需要在两个位置显示(一次在主页正文中,一次通过对话框)。目前其代码已在页面中添加了两次。现在我在想,是否有一种方法可以只包含它一次并在对话框中显示相同的实例,就像在主页正文中一样。
你能建议一种方法吗?
我正在使用:-
JSF 2.0 和 Facelets
Primefaces 3.0 M3 快照
I have a widget in my application that I need to display at two places(once in main page body and once through dialog box). Currently its code has been added twice in the page. Now I was thinking, If there was a way I could just include it only once and show the same instance in the dialog box, as in the main page body.
Can you suggest a way for this?
I'm Using:-
JSF 2.0 with Facelets
Primefaces 3.0 M3 Snapshot
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
JSF 2 正是您想要的功能:它被称为复合组件< /a>.我基本上允许您将一堆 Facelet 代码写入一个文件中,并像任何其他 JSF 组件一样使用它,向其传递参数等。
JSF 2 has exactly the feature you want: it's called composite components. I bascially allows you to write a bunch of Facelet code into a file and use it just like any other JSF component, pass parameters to it, etc.