h:带有EnumConverter的selectOneMenu正在更新为空值

时间:2014-11-18 10:12:35

标签: jsf-1.2

在下面的示例中,转换器在提交表单时正常工作。但是,当尝试在事件' onchange'中执行任何操作时,类型' enum'更改为 null 。经过多次尝试和研究,使用valueChangeListener,onchange =" submit()"和立即="真",没有解决。

枚举

public enum TipoGasCondicaoUsoPermeacao {

    CONCENTRACOES("Concentrações"),
    FUGACIDADES("Fugacidades"),
    PRESSOES_PARCIAIS("Pressões parciais");

    private String label;

    private TipoGasCondicaoUsoPermeacao(String label) {
        this.label = label;
    }

    /**
     * @return the descricao
     */
    public String getLabel() {
        return this.label;
    }
}

XHTML

<h:selectOneMenu value="#{condicaoUso.tipoGasCondicao}" required="false" styleClass="field_form medio">
    <f:selectItems value="#{listaMB.tiposGasCondicoesUso}" id="itemTipoGas" />
    <a4j:support event="onchange" oncomplete="dadosAlterados(true)" reRender="otherPanel" />
</h:selectOneMenu>

面-config.xml中

 <converter>
  <converter-for-class>java.lang.Enum</converter-for-class>
  <converter-class>javax.faces.convert.EnumConverter</converter-class>
 </converter>

1 个答案:

答案 0 :(得分:0)

问题一直持续到我使用属性ajaxSingle =“true”(默认为'false'),如下所示:

<a4j:support event="onchange" oncomplete="dadosAlterados(true)" reRender="otherPanel" ajaxSingle="true" />

魔术?