0

私はうまく機能しているビューを持っています。ただし、required="true" をビューの本文に追加すると、ビューがバッキング Bean を正しく読み取れなくなります。以下は比較です。

誰でも理由を知っていますか?

必須なし= 知恵が必要= .

編集:コードフラグメントの補足

以下は、問題が発生した私のコードの一部です。required="true"を任意の p:inputText (このダイアログに属する p:inputText だけでなく、html 本文内の p:inputText も)に追加すると、バッキング Bean からの情報の表示が停止し、削除され、すべてが機能します。大丈夫。

<p:dialog header="Customer Editor" widgetVar="customerEditDialog"
                resizable="false" id="customerEditDlg" showEffect="fade"
                hideEffect="fade" modal="true">

                <h:panelGrid id="editGrid" columns="2" cellpadding="4"
                    style="margin:0 auto;">

                    <h:outputLabel for="customerNameEdit" value="Name: " />
                    <p:inputText id="customerNameEdit" maxlength="30"
                        value="#{customerController.customerAdd.name}" />
                    <h:outputLabel for="customerPhoneNumberEdit" value="Phone Number " />
                    <p:inputText id="customerPhoneNumberEdit" maxlength="15"
                        onkeypress="if(event.which  &lt; 48 || event.which  &gt; 57) return false;"
                        value="#{customerController.customerAdd.phoneNumber}" />
                    <h:outputLabel for="customerEmailEdit" value="Email: " />
                    <p:inputText id="customerEmailEdit" maxlength="49"
                        value="#{customerController.customerAdd.email}" />
                    <h:outputLabel for="customerAddressEdit" value="Address: " />
                    <p:inputText id="customerAddressEdit" maxlength="190"
                        value="#{customerController.customerAdd.address}" />
                    <f:facet name="footer">
                        <div style="text-align: right">
                            <p:commandButton id="editCustomerButton"
                                update=":form:customerList, :form:messages"
                                oncomplete="customerEditDialog.hide()" value="Save"
                                actionListener="#{customerController.editCustomer()}">
                            </p:commandButton>

                            <p:commandButton id="cancelEditCustomerButton" update=":form"
                                onclick="customerEditDialog.hide()" value="Cancel">
                            </p:commandButton>
                        </div>
                    </f:facet>
                </h:panelGrid>
            </p:dialog>
4

1 に答える 1

1

jsf required=true が setPropertyActionListener を破棄するかどうかを確認しますか? あなたを助けます。

問題は、どこかで検証エラーが発生したか、<h:form>要素をネストしているために、Bean のセッターが呼び出されない可能性が最も高いです。

于 2014-02-19T10:41:41.190 に答える