【发布时间】:2015-02-13 23:23:18
【问题描述】:
当我尝试在下拉列表中选择一个值时,我的 SelectOneChoice 的 valueChangeListener 没有被调用。只有当我单击下拉列表中的空白项(我们在 ListOfValues 中配置)时才会调用它。 在一些研究中,我了解到在您的 valueChangeListener 中,我们必须添加
vce.getComponent().processUpdates(FacesContext.getCurrentInstance());
作为我们的第一行。但是它仍然没有在选择除 null 之外的任何其他值时被调用。
我的 SelectOneChoice 的代码
<af:selectOneChoice value="#{bindings.Prefix.inputValue}"
label="#{bindings.Prefix.label}"
shortDesc="#{bindings.Prefix.hints.tooltip}"
id="soc3"
partialTriggers="formatIdId"
visible="#{bindings.Prefix.hints.visible}"
binding="#{backingBeanScope.CreateItemBackingBean.prefixField}"
required="#{bindings.ItemNumberType.attributeValue eq 'VPLU'}"
showRequired="#{bindings.Prefix.hints.mandatory}"
validator="#{backingBeanScope.CreateItemBackingBean.onValidatePrefix}"
autoSubmit="true"
valueChangeListener="#{backingBeanScope.CreateItemBackingBean.onChangePrefix}">
<f:selectItems value="#{bindings.Prefix.items}" id="si3"/>
<af:convertNumber groupingUsed="false"
pattern="#{bindings.Prefix.format}"/>
</af:selectOneChoice>
我的 ValueChangeListener 的代码
public void onChangePrefix(ValueChangeEvent vce) {
vce.getComponent().processUpdates(FacesContext.getCurrentInstance());
System.out.println("vce.getOldValue()"+vce.getOldValue());
System.out.println("vce.getNewValue()"+vce.getNewValue());
System.out.println("I am in changed prefix");
}
【问题讨论】:
标签: oracle-adf jdeveloper