p:inputText无法设置值

时间:2014-05-15 04:59:39

标签: jsf primefaces

我无法将值设置为policyCriteria。当我点击搜索命令按钮时,<p:inputText>中的值未设置为poliyCriteria

我已经尝试了process="@this",给了commandButton ajax="false"

这是我的XHTML代码。

<table width="100%">
    <tr>
        <td colspan="3">
            <h:outputText styleClass="table-title" value="Life Policy Endorsement Management" />
            <p:separator style="height:5px" />
        </td>
    </tr>
    <tr>
        <td>
            <h:outputText value="" />
        </td>
        <td>
            <p:message for="selectPolicyCriteria" id="lifePolicyMsgSelect" />
        </td>
        <td>
            <p:message for="policyCriteria" id="lifePolicyMsg" />
        </td>
    </tr>
    <tr>
        <td style="font-weight: bold;" width="130px;">
            <h:outputText value="Select Policy Number: " />
        </td>
        <td width="120px;">
            <p:selectOneMenu converter="omnifaces.SelectItemsIndexConverter" id="selectPolicyCriteria" value="#{LifePolicyEndorsementActionBean.policyCriteria.policyCriteria}">
                <f:selectItem itemLabel="Select Criteria" />
                <f:selectItems value="#{LifePolicyEndorsementActionBean.policyCriteria.policyCriteriaItemList}" />
            </p:selectOneMenu>
        </td>
        <td>
            <p:inputText id="policyCriteria" style="height:20px;width: 200px;" value="#{MotorPolicyEndorsementActionBean.policyCriteria.criteriaValue}" />
        </td>
    </tr>
    <tr>
        <td colspan="2">
            <h:panelGrid cellpadding="5" columns="2">
                <p:commandButton action="#{LifePolicyEndorsementActionBean.search()}" id="searchBtn" update="lifePolicyTablePanel lifePolicyMsg lifePolicyMsgSelect" value="Search"/>
                <p:commandButton action="#{LifePolicyEndorsementActionBean.reset()}" id="resetBtn" update="LifePolicyEndorsementForm" value="Reset"/>
            </h:panelGrid>
        </td>
    </tr>
</table>

这是backingBean

public void search() {
    if (inputCheck(policyCriteria)) {
        lifePolicyList = lifePolicyService.findLifePolicyByPolicyCriteria(policyCriteria, 30);
    }
}

public void reset() {
    policyCriteria.setCriteriaValue(null);
    policyCriteria.setPolicyCriteria(null);
    lifePolicyList.clear();
}

private boolean inputCheck(PolicyCriteria policyCriteria) {
    boolean result = true;
    String formId = "LifePolicyEndorsementForm";

    if ((policyCriteria.getPolicyCriteria() == null) || (policyCriteria.getPolicyCriteria().toString().equals("Select"))) {
        addErrorMessage(formId + ":selectPolicyCriteria", MessageId.PLEASE_SELECT_POLICY_CRITERIA);
        result = false;
    }

    if (StringUtils.isBlank(policyCriteria.getCriteriaValue())) {
        addErrorMessage(formId + ":policyCriteria", MessageId.CRITERIA_VALUE_REQUIRED);
        result = false;
    }
    return result;
}

0 个答案:

没有答案