Warning: file_get_contents(/data/phpspider/zhask/data//catemap/7/jsf/5.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Jsf Primefaces对话框框架在初始化时关闭_Jsf_Primefaces_Jsf 2 - Fatal编程技术网

Jsf Primefaces对话框框架在初始化时关闭

Jsf Primefaces对话框框架在初始化时关闭,jsf,primefaces,jsf-2,Jsf,Primefaces,Jsf 2,我有与中提到的相同的要求” “但唯一的答案不是有效的解决方案,因为在Dialog框架中,我没有一个widgetVar 我的@PostConstruct方法看起来类似: @PostConstruct private void init() { Tree tree = initTree(); if (tree.getChildCount() == 1) { // @todo close dialog if tree has only 1 child

我有与中提到的相同的要求” “但唯一的答案不是有效的解决方案,因为在Dialog框架中,我没有一个
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()");
    }
}
那么,如何从DialogFramework的
@PostConstruct
方法关闭DialogFramework xhtml页面呢


我在Wildfly 10.0.0上使用Primefaces 6.0。Final

为什么没有widgetVar?如何使用对话框框架设置widgetVar?!你看到这篇文章了吗?试图在postConstruct中关闭对话框是一种奇怪(或至少非常罕见)的方式来解决(对于我们未知的)需求。@Kukeltje:更好的解决方案是创建我的对象树,如果树中有多个子对象,则显示对话框。关键是,我想在对话框中显示树,但无法使用
RequestContext.getCurrentInstance().openDialog(“,options,params)
中的参数映射将树传递给对话框bean。只有通过sessionMap才能通过树?!