Primefaces DialogFramework在init上关闭

时间:2017-03-08 14:24:29

标签: jsf primefaces jsf-2

我的要求与“ primefaces close dialog on init don't work“但唯一的答案不是一个有效的解决方案,因为在Dialog Framework中我没有widgetVar

我的@PostConstruct方法看起来很相似:

@PostConstruct
private void init() {
    Tree tree = initTree();
    if (tree.getChildCount() == 1) {
        // @todo close dialog if tree has only 1 child

        // this does not close the dialog
        RequestContext.getCurrentInstance().closeDialog(true);

        // this does not work, because there is no widgetVar
        //RequestContext.getCurrentInstance().execute("yourDialogWidgetVar.close()");
    }
}

那么,如何从@PostConstruct方法关闭DialogFramework xhtml页面呢?

我在Wildfly 10.0.0.Final上使用Primefaces 6.0

0 个答案:

没有答案