我试图通过 SelectOneRadio 组件调用 java 中的方法,但没有任何反应。但是该组件是由我公司创建的以接受 ENUM。
组件:
<composite:interface>
<composite:attribute name="label" />
<composite:attribute name="value" />
<composite:attribute name="converter" />
<composite:attribute name="lista" />
<composite:attribute name="enumClass" />
<composite:attribute name="id" default="campo"/>
<composite:attribute name="columns" default="1"/>
<composite:attribute name="required" default="false"/>
<composite:attribute name="disabled" default="false"/>
<composite:attribute name="tamanhoTotal" default="12"/>
<composite:attribute name="tamanho" default="10"/>
<composite:attribute name="tamanhoLabel"/>
<composite:attribute name="layout" default="lineDirection"/>
<composite:clientBehavior name="change" event= "change" targets = "campo"/>
<composite:implementation>
<p:selectOneRadio id="#{cc.attrs.id}"
value="#{cc.attrs.value}"
disabled="#{cc.attrs.disabled}"
columns="#{cc.attrs.columns}"
layout="#{cc.attrs.layout}"
required="#{cc.attrs.required}"
label="#{cc.attrs.label}"
converter="#{cc.attrs.converter}"
requiredMessage="#{cc.attrs.label} : Campo obrigatório">
<f:selectItems value="#{referenciaMap[cc.attrs.enumClass]}"/>
</p:selectOneRadio>
直到现在尝试一下:
这是我的 XHTML:
<campo:radio enumClass="StatusTituloEnum"
label="Situação" tamanho="1" tamanhoTotal="1"
columns="1" layout="grid"
disabled="#{!recTituloCriteria.disableRadioStatus}"
converter="#{StatusTituloConverterById}">
<p:ajax event="change" process="@this"
update=":form:idTabela" listener="#{recTituloCriteria.handleKeyEvent}" />
</campo:radio>
这是我在 JAVA 中的方法:
public void handleKeyEvent() {
//text = text.toUpperCase();
System.out.println("hi");
}