1

私はさまざまなフォーラムで調査していますが、類似したものや、問題を解決できるものは見つかりませんでした。

私には2つのフィールドがあります。左側にオブジェクトを作成します。右側では、これらのオブジェクトテーブルに自動的に表示されます。

期待した結果が得られません。ページ全体を更新する必要があります。

助けて=/

コード-------------------------------

<p:layoutUnit position="west" size="480" id="layout1">

    <h:form id="form_unidadeCadastro">
        <p:panel id="panelUnidadeCadastro" header="Criar Unidade"
            style="width:473px;">

            <p:messages id="msgs" />
            <p:focus for="nome" />

            <h:panelGrid columns="2">
                <h:outputText value="Nome:" />
                <p:inputText id="nome" size="30"
                    value="#{unidadeBean.unidade.nome}" required="true" label="Nome" />

                <h:outputText value="Endereço:" />
                <p:inputText id="endereco" size="30"
                    value="#{unidadeBean.unidade.endereco}" required="true"
                    label="Endereco" />

                <h:outputText value="Bairro:" />
                <p:inputText id="bairro" value="#{unidadeBean.unidade.bairro}"
                    required="true" label="Bairro" />

                <h:outputText value="Cidade:" />
                <p:inputText id="cidade" value="#{unidadeBean.unidade.cidade}"
                    required="true" label="Cidade" />

                <h:outputText value="Telefone:" />
                <p:inputMask id="telefone" size="15"
                    value="#{unidadeBean.unidade.telefone}" mask="(99) 99999999?9"
                    required="true" label="Telefone" />

                <h:outputText value="E-mail:" />
                <p:inputText id="email" value="#{unidadeBean.unidade.email}"
                    required="true" label="Nome" />

            </h:panelGrid>
            <p:commandButton value="Criar" actionListener="#{unidadeBean.salvar}" update=":form_unidadeCadastradas:tab_unidadeCadastradas"/>

        </p:panel>
    </h:form> 



</p:layoutUnit>

<p:layoutUnit position="center" id="center_center">

    <h:form id="form_unidadeCadastradas">
        <p:dataTable id="tab_unidadeCadastradas" var="u" value="#{unidadeBean.listar}" style="width:657px;border-radius:5px;">
            <p:column headerText="Unidades Criadas" style="border-radius:5px;font-size: 15px;">
                <h:outputText value="#{u.nome}" />
            </p:column>
        </p:dataTable>
    </h:form>

</p:layoutUnit>

4

2 に答える 2

0

ajax="false"commandButton に追加してみてください。(自分でもわかりません。)

于 2012-12-11T18:56:42.473 に答える
0

If you are absolute sure about java implementation (that you hadn't posted), I suggest to update just the form and not the datatable, the content would be update automatically.

<p:commandButton value="Criar" actionListener="#{unidadeBean.salvar}" update=":form_unidadeCadastradas"/>

If this doesn't work, then post the java code, the problem would be probably there.

于 2012-12-12T08:40:08.483 に答える