【发布时间】:2014-09-16 12:56:45
【问题描述】:
我有一个 Primefaces 项目,我试图在其中复制桌面应用程序的行为。由于桌面应用的性质,弹出的对话框比较多,导致页面处理变得很慢(初始页面加载:10-20秒,AJAX请求:6-10秒)。
我已经为所有对话框提供了单独的文件,我想使用支持 bean 将它们作为对话框弹出,而不必在我的主文件中使用 <ui:include>。有没有办法做到这一点?
例如:
<p:commandButton id="showSearchDialog"
action="#{managedBean.showSearchDialog()}"/>
<p:dialog widgetVar="searchDialog">
</p:dialog>
public class ManagedBean {
public void showSearchDialog() {
//Some sort of function that knows to process the contents of searchDialog.xhtml
// and insert it into the relevant <p:dialog>
RequestContext.getCurrentInstance().execute("PF('searchDialog').show()");
}
}
【问题讨论】:
标签: jsf primefaces dialog jsf-2.2