Get the display value of selectonechoice or LOV in bean – Oracle ADF

I found one approach to get the display value of LOV in managed bean using  ADFUtils.evaluateEl method.

Say if you have a value change listener for an lov,  valueChangeEvent.getNewValue() gives the index of the value. To get the display value of the lov, use below logic  :

public void onDeptNameChange(ValueChangeEvent valueChangeEvent) {

Object deptNameAttribute = ADFUtils.evaluateEL("#{bindings.deptName.items['"+valueChangeEvent.getNewValue().toString()+

"'].label}");

String deptNameStr = deptNameAttribute .toString();  // This should have the selected display value of lov.

}

Say if you want to access the display value of LOV, in any other method, other than valueChange listener, then use below code :

Object deptNameAttribute = ADFUtils.evaluateEL("#{bindings.deptName.items['"+ADFUtils.getBoundAttributeValue("deptId")+"'].label}");

Here deptId is the code of this lov.  Hope this is helpful.

Happy learning with Techartifact……

Chaitanya tupurani

Hello. I am a software professional working on Java/J2EE having 6 years of experience...I am learning more concepts on Core Java, Oracle ADF, PL/SQL, Hibernate, Springs. I want to share my knowledge while I am learning these technologies..

More Posts

Follow Me:
FacebookLinkedIn