Skip to main content

Defining multiple eventBindings

While working on specific use case, came across scenario where I had to define separate Contextual Events for different button's on a page.

Story in nutshell, a page is having two command buttons, each one should trigger Contextual Event with different payloads. Unfortunately 'Contextual Event' editor was not letting me to generate two event bindings.[Please note that this issue is rectified in latest internal builds, hopefully next public release may have this fix] So I went ahead and created this binding manually. I'm just sharing the manual binding tat I created here. I hope this may help you if you face similar issues during development.

JSF tags may look like as shown below

<af:commandButton text="commandButton 1" id="cb1"
  actionListener="#{bindings.eventBinding1.listener.processAction}"/>
<af:commandButton text="commandButton 2" id="cb2"
  actionListener="#{bindings.eventBinding2.listener.processAction}"/>

Page definition file may look like as shown below

  <bindings>
    <eventBinding id="eventBinding1"
                  Listener="javax.faces.event.ActionListener">
      <events xmlns="http://xmlns.oracle.com/adfm/contextualEvent">
        <event name="Event1" customPayLoad="Test1" eventType="Action Event"/>
      </events>
    </eventBinding>
    <eventBinding id="eventBinding2"
                  Listener="javax.faces.event.ActionListener">
      <events xmlns="http://xmlns.oracle.com/adfm/contextualEvent">
        <event name="Event2" customPayLoad="Test2" eventType="Action Event"/>
      </events>
    </eventBinding>
  </bindings>

Comments

Popular posts from this blog

How to set Bind Variable Values at runtime ?

In this post I'm sharing a couple of approaches for programmatically setting bind variables values at run time. This post is an attempt to explain 'When to use what ?'[ In case if you are familiar with 'Bind Variables' in ADF BC, please refer Section 5.10, Working with Bind Variables in Fusion Developer's Guide ]

1. Set the Bind Variable value using RowSet::setNamedWhereClauseParam(...)

You can use use the setNamedWhereClauseParam(...) method on the ViewObject interface (which extends oracle.jbo.RowSet) to set the value for bind variables. Please note this sets the value on default RowSet. In other words, this doesn't have any effect on the secondary RowSets that you/system generates.
ViewObject vo = am.findViewObject("EmployeesView1"); vo.setNamedWhereClauseParam("bindVarDeptId", new Number(10)); vo.executeQuery();
2. Set the Bind Variable value using ViewObject's VariableValueManager::setVariableValue(...)

VariableValueManager Ma…