primefaces自动完成验证问题

时间:2013-06-18 07:30:25

标签: validation jsf primefaces autocomplete

我遇到p:autocomplete的问题:当任何其他字段的验证失败时,我会错过自动完成的输入。我该怎么做才能避免这种情况?

我正在使用mojarra 2.1.18的素面3.5。这是代码:

<h:outputLabel for="employmentTitle" value="Dienstbezeichnung:" />
<p:autoComplete id="employmentTitle" minQueryLength="3" maxResults="20" value="#{contactManagedBean.contactPerson.employmentTitle}" label="Dienstbezeichnung" var="e" itemValue="#{e}"
    itemLabel="#{e.value}" effect="fade" completeMethod="#{contactManagedBean.completeEmploymentTitles}" converter="#{keyValueTableConverter}">
    <f:validator validatorId="contactPersonTypeFacesValidator" />
    <f:attribute name="contactPerson" value="#{contactManagedBean.contactPerson}" />
    <f:attribute name="personTypeComponent" value="#{personTypeComponent}" />
</p:autoComplete>

编辑:

对不起我的错。我的KeyValueTableConverter错过了对服务bean的调用,如下所示:

/**
 * 
 * make an object from web request param
 */
@Override
public Object getAsObject(FacesContext context, UIComponent component, String param) {

    KeyValueTable k = null;

    try {

        k = serviceBean.getValuesById(Long.parseLong(param));

    } catch (Exception e) {

        logger.error("Error while making an object from web request param: " + param + " keyvaluetable: " + k, e);
    }

    return k;
}

0 个答案:

没有答案