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 在对话框中显示变量值_Jsf_Primefaces_Dialog - Fatal编程技术网

Jsf 在对话框中显示变量值

Jsf 在对话框中显示变量值,jsf,primefaces,dialog,Jsf,Primefaces,Dialog,在执行commandbutton中调用的方法后,我需要在对话框中显示一个值,但对话框不显示变量值。 变量值在commandbutton内计算 豆角 @ManagedBean @ViewScoped public class OrderBean implements Serializable { private String name; public String getName() { return name; } public void

在执行commandbutton中调用的方法后,我需要在对话框中显示一个值,但对话框不显示变量值。 变量值在commandbutton内计算

豆角

@ManagedBean
@ViewScoped
public class OrderBean implements Serializable {
    private String name;

    public String getName() {
        return name;
    }  

    public void setName(String name) {
        this.name = name;
    }

    public void eventicus(ActionEvent event) {
        this.name ="Value";
    }
}
xhtml文档

        <h:commandButton actionListener="#{orderBean.calculate()}"  value="Show" oncomplete="PF('dlg2').show();"  />

    <p:dialog id="modalDialog" header="Modal Dialog" widgetVar="dlg2" >                 
        <h:panelGrid columns="2" style="margin-bottom:10px">                
            <h4><h:outputText value="#{orderBean.name}" /></h4>  
        </h:panelGrid>          
        <p:commandButton id="submitButton" value="Submit" oncomplete="PF('dlg2').hide();"/>                   
    </p:dialog> 


单击commandbutton时,对话框为空。

1我认为您需要在commandbutton中添加[update=“modalDialog”]属性

我认为您需要在commandbutton中添加[update=“modalDialog”]属性。我很有帮助。是的,当添加属性“更新”时,它起作用了。