Jsf 如何在primefaces中重新创建对话框

Jsf 如何在primefaces中重新创建对话框,jsf,primefaces,dialog,Jsf,Primefaces,Dialog,我想重新创建一个对话框,而不是用当前内容重新显示。我使用: RequestContext.getCurrentInstance().execute("PF('dialogId').show()"); 显示对话框和 RequestContext.getCurrentInstance().execute("PF('dialogId').hide()"); 对支持bean隐藏对话框 如果我使用 RequestContext.getCurrentInstance().execute("PF('dia

我想重新创建一个对话框,而不是用当前内容重新显示。我使用:

RequestContext.getCurrentInstance().execute("PF('dialogId').show()");
显示对话框和

RequestContext.getCurrentInstance().execute("PF('dialogId').hide()");
对支持bean隐藏对话框

如果我使用

RequestContext.getCurrentInstance().execute("PF('dialogId').content.empty()");
在show()之前,则对话框为空

我也试过了

RequestContext.getCurrentInstance().execute("PF('dialogId').remove()");
在show()之前,但根本不显示对话框

我想重新创建而不是重新显示的原因是我在dialog bean init函数中创建了树节点。在显示对话框之前,必须从数据库中获取Treenodes数据

我只想在每次显示dialog时调用dialog bean的init函数,而不是第一次

我的初始化函数:

@PostConstruct
public void init(){
    root = new DefaultTreeNode("Root Node", null);
    // code for creating other TreeNodes
}

请重新格式化你的问题很难阅读,可能与我重新格式化的问题重复。我已经尝试了这两种解决方案,但在重新显示dialog时仍然没有调用dialog的init函数。如何调用init函数?我在上面的问题中添加了init函数。。我还尝试用默认构造函数替换init函数,但它也只有在第一次显示对话框时才被调用。