This discussion is archived
2 Replies Latest reply: Jul 8, 2009 9:17 PM by LucasJellema RSS

Programmatically publishing Contextual Events

LucasJellema Oracle ACE
Currently Being Moderated
Does anyone know whether there is a programmatic way of publishing contextual events? The usual route of course involves invoking an operationBinding or updating an attributeValueBinding, but those seem some what complex ways of publishing an event if you would want to do so from for example a serverListener or some other part of managed bean logic.


  • 1. Re: Programmatically publishing Contextual Events
    Frank Nimphius Employee ACE
    Currently Being Moderated

    Below is an event producer binding and the code that invokes it from an ADF Faces button. If you call the same from a managed bean then you need to create the
    ActionEvent manually before you invoke it
    <eventBinding id="MyEventBinding"
       <events xmlns="">
         <event name="mActionEvent"/>
    public void onEmployeeSelect(ActionEvent actionEvent) {
      BindingContext bctx = BindingContext.getCurrent();
      BindingContainer bindings = bctx.getCurrentBindingsEntry();
      JUEventBinding eventBinding = null;
      //get a handle to the eventBinding
      eventBinding = (JUEventBinding) bindings.get(“MyEventBinding”);
      ActionListener al = (ActionListener)eventBinding.getListener();
  • 2. Re: Programmatically publishing Contextual Events
    LucasJellema Oracle ACE
    Currently Being Moderated
    Hi Frank,

    Thanks for your reply. I was NOT aware of this solution - at least not the eventBinding. I did know about the solutionof creating an actionBinding/methodBinding that was only meant for triggering the event.

    However, I was hoping to get by without a PageDefinition with 'fake' Data Bindings to produce an event. I have a task flow that only uses managed beans and does not currently have a page definition, data bindings etc. This solution you also propose seems very heavy handed for just publishing an event. You do not happen to know of a lighter weight approach? I am wondering why I would need a page definition and data bindings to raise an event. Any further thoughts?



    Edited by: Lucas Jellema on Jul 9, 2009 6:15 AM - note that eventBinding was new to me (I had read sloppily and only noticed the use of the PageDef with special bindings that I tried to avoid).


  • Correct Answers - 10 points
  • Helpful Answers - 5 points