Oracle JDeveloper 11.1.1.3
ADF Faces Rich Components
Sometime your program logic needs to get Actual value of selected item in af:selectOneChoice in java code.
And SelectChoice is attached by a VO for fetching all values.
Well, when you use some basic operations in ValueChangeListener method, you notice that its returning only the index of item or old actual value.
Refer some codes -
Here is successful approach for getting Actual Selected Current Value & not the old value.
Set Autosubmit=true for SelectChoice.Goto PageDef of your jsf page.
Right click on bindings node then insert inside bindings , Generic Binding &
Attribute Values.In the dialog, choose your parent ViewObject Iterator & then attribute
on which LOV was created.
ADF Faces Rich Components
Sometime your program logic needs to get Actual value of selected item in af:selectOneChoice in java code.
And SelectChoice is attached by a VO for fetching all values.
Well, when you use some basic operations in ValueChangeListener method, you notice that its returning only the index of item or old actual value.
Refer some codes -
String selectedItem = (String)selectListBinding.getAttributeValue() ; //old actual value
valueChangeEvent.getNewValue() ; //will give new index no irrespective of valuePassThru = true/false
valueChangeEvent.getOldValue(); //will give old index no irrespective of valuePassThru = true/false
Row row = (Row)selectListBinding.getSelectedValue();
oracle.jbo.domain.Number no= (Number)row.getAttribute("Deptid");//Old actual value
Here is successful approach for getting Actual Selected Current Value & not the old value.
Set Autosubmit=true for SelectChoice.Goto PageDef of your jsf page.
Right click on bindings node then insert inside bindings , Generic Binding &
Attribute Values.In the dialog, choose your parent ViewObject Iterator & then attribute
on which LOV was created.
Write this code in Listener Method -
public void SelectionListener(ValueChangeEvent valueChangeEvent)
{
BindingContainer container = BindingContext.getCurrent().getCurrentBindingsEntry();
valueChangeEvent.getComponent().processUpdates(FacesContext.getCurrentInstance());
AttributeBinding attrIdBinding = (AttributeBinding)container.getControlBinding("Deptno");
//Deptno is ID of an Attribute Binding in pageDef
oracle.jbo.domain.Number Id = (Number)attrIdBinding.getInputValue();
System.out.println("Id- " + Id);
}