【发布时间】:2012-12-29 06:25:25
【问题描述】:
我有一个页面,我想在其上显示一个对话框。
代码:
page1.xhtml
<p:commandLink value="Show Dialog" oncomplete="dlgWVar.show();"/>
<p:dialog widgetVar="dlgWVar"
width="800"
id="dialog"
position="top"
modal="true"
header="Test Dialog"
height="500">
<iframe src="page2.xhtml" width="100%" height="500px" style="border-width: 0PX;">
</iframe>
</p:dialog>
现在在这个对话框中,我有一个 iFrame,其中 page2.xhtml 被链接。
page2.xhtml
<p:commandButton value ="Close Dialog">
</p:commandButton>
page2.xhtml 包含一个命令按钮。现在我必须在单击命令按钮后关闭对话框。
不知道该怎么做。 我应该在 page2.xhtml 上的 commandButton 中写什么,以便关闭 page1.xhtml 上的对话框。请帮忙。
谢谢。
【问题讨论】:
-
这是非常糟糕的设计。您应该通过 Facelets 而不是 HTML iframe 使用服务器端包含/模板。
-
感谢 BalusC 的建议。我要改进我的设计。
标签: jquery jsf jsf-2 primefaces