0

我有一个 html 文本框帐号,我正在尝试将文本框的值更新为 null,并且不允许将其更新为 null,调用是通过 ajax 进行的。我在同一页面上有类似的文本框费用类型,效果很好。这两列在数据库中都可以为空。当我在调试模式下检查时,帐号永远不会显示为空,而是显示保留在 db 中的先前值。OnRowedit 方法 -> event.get object() 始终具有先前的值。我看到很少有其他提到需要 init() 的链接,而且我的 bean 类中确实有。请协助。非常感谢任何指针。

下面是我的xhtml:

<p:column headerText="Account Number" width="65">
                <p:cellEditor>
                    <f:facet name="output">
                        <h:outputText value="#{record.acctNbr}" />
                    </f:facet>
                    <f:facet name="input">
                        <h:inputText id="formAcctNbr" label="Account Number"
                            value="#{record.acctNbr}" maxlength="6"
                            validatorMessage="Account Number is Numeric of lenghth '6'">
                            <f:validateLength minimum="6" maximum="6" />
                            <f:validateRegex pattern="[0-9]*" />
                        </h:inputText>
                        <h:message for="formAcctNbr" style="color:red" />
                    </f:facet>
                </p:cellEditor>
            </p:column>



<p:column headerText="Fee Type" width="60">
                <p:cellEditor>
                    <f:facet name="output">
                        <h:outputText value="#{record.feeType}" />
                    </f:facet>
                    <f:facet name="input">
                        <h:inputText id="formFeeType" label="Fee Type" 
                            value="#{record.feeType}" maxlength="5"
                            validatorMessage="Fee Type is Numeric between 1 and 32767">
                            <f:validateLongRange minimum="1" maximum="32767" />                         
                        </h:inputText>
                        <h:message for="formFeeType" style="color:red" />
                    </f:facet>
                </p:cellEditor>
            </p:column>

下面是我的javaBean:

public class AcctRefTo implements Serializable {

 private Short feeType;
 private String acctNbr;

public Short getFeeType() {
        return feeType;
    }

    public void setFeeType(Short feeType) {
        this.feeType = feeType;
    }
public String getAcctNbr() {
        return acctNbr;
    }

public void setAcctNbr(String acctNbr) {
        if (acctNbr!= null) {
            this.acctNbr= acctNbr.trim();
        }
    }
}
4

0 回答 0