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
Page definition file may look like as shown below
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
Post a Comment