Get value of the outputtext in javascript and access to backing bean in Oracle ADF

Requirement -Get value of the outputtext in javascript and send it to backing bean in Oracle ADF
Solution – We will use clientListener to call java script function and Serverlistener for calling java function

Below is the code for accomplish this

– page code

    <af:outputText value="value outputText" id="ot32" clientComponent="true"
        <af:clientListener type="mouseOver"
        <af:serverListener type="mycustomserverEvent" method="#{OutputTextCase11.handleServerEvent}"/>                
    <af:outputText value="Init" shortDesc="shortDesc" id="ot1" clientComponent="true"/>

– find javascript function code

   var customJsFunction = function(event)
      var exceptiondata = event.getSource().findComponent("ot32").getValue();
      return true;

– method in bean

  public void handleServerEvent(ClientEvent ce)
    String param = (String)ce.getParameters().get("param1");
    RichOutputText outputText=(RichOutputText)ce.getComponent().findComponent("ot1");

happy coding with Vinay in techartifact….

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()+


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……