Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/jsf-2/2.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 打开时为空变量<;p:dialog>;-JFS 2.0,Primefaces_Jsf_Jsf 2_Primefaces - Fatal编程技术网

Jsf 打开时为空变量<;p:dialog>;-JFS 2.0,Primefaces

Jsf 打开时为空变量<;p:dialog>;-JFS 2.0,Primefaces,jsf,jsf-2,primefaces,Jsf,Jsf 2,Primefaces,你好吗 也许现在是个新手问题。现在我在表单中有一个输入和一个“提交”按钮。当我单击submit时,这不会调用任何方法,这只会打开一个。当这个对话框打开时,输入中的变量没有设置,所以我的另一个输入没有显示任何内容 查看要理解的图像: 单击“提交”(Adicionar)后: 第二个图像必须显示与第一个输入完全相同的值,但正如您所看到的,这只是显示一个空输入 现在让我们转到我的代码 这是我的JSF: <h:form id="inserirDisciplina"> <h:

你好吗

也许现在是个新手问题。现在我在表单中有一个输入和一个“提交”按钮。当我单击submit时,这不会调用任何方法,这只会打开一个
。当这个对话框打开时,输入中的变量没有设置,所以我的另一个输入没有显示任何内容

查看要理解的图像:

单击“提交”(Adicionar)后: 第二个图像必须显示与第一个输入完全相同的值,但正如您所看到的,这只是显示一个空输入


现在让我们转到我的代码

这是我的JSF:

<h:form id="inserirDisciplina">

    <h:inputText styleClass="form-control" id="disciplina" value="#{cursoMBean.nome}"
      valueChangeListener="#{cursoMBean.atualizarListagemPesquisa}">
      // atualizarListagemPesquisa just update the arraylist to be shown in dataTable

        <f:ajax event="keyup" render=":meuForm:minhaTabela" />
    </h:inputText>

    <h:commandButton value="Adicionar" styleClass="btn btn-md btn-success">
        <p:ajax event="click" update=":meuForm:display" render=":meuForm:dialog" oncomplete="PF('insert').show();" onerror="alert('erro');" />
    </h:commandButton>

    <p:dialog id="dialog" header="Inserir Curso" widgetVar="insert" resizable="false" modal="true" width="600" height="500" hideEffect="clip" closeOnEscape="true" focus="enviar">
            <h:panelGrid id="display" styleClass="col-lg-10 center">
                 <label for="nome">Nome:</label>
                 <p:inputText styleClass="form-control adicionar" id="nome" value="#{cursoMBean.nome}" />
             </h:panelGrid>

                ...
private String nome;

public String getNome() {
    return nome;
}

public void setNome(String nome) {
    this.nome = nome;
}
编辑(新视图):

诺姆:
库索的纪律:

我做错了什么?

请尝试以下按钮代码:

<p:commandButton value="Adicionar" styleClass="btn btn-md btn-success"
   process="disciplina" partialSubmit="true" update=":inserirDisciplina:display"
   oncomplete="insert.show();" onerror="alert('erro');">
</p:commandButton>


您是否得到与以前相同的结果?是的,没有显示任何内容。奇怪的是:当我提交(将输入字段留空)时,规程用正确的名称注册。所以,问题是p:dialog没有显示名称,但是当我提交对话框时,会提交正确的名称。您的表单id是
inserirDisciplina
,那么您为什么到处使用
meuForm
?更改该选项,然后重试。
meuForm
是显示
规程
结果的数据表。当我在输入中(对话框外)键入内容时,我的数据表
:meuForm:minhaTabela
将用新的匹配
规程更新。这有点像实时搜索,但对话框不在该窗体内。或者您有嵌套表单吗?哪个是托管bean的作用域?作用域是@Session
<p:commandButton value="Adicionar" styleClass="btn btn-md btn-success"
   process="disciplina" partialSubmit="true" update=":inserirDisciplina:display"
   oncomplete="insert.show();" onerror="alert('erro');">
</p:commandButton>