What you may need to know about <events> definitions in PageDef file

I'm not sure how many of you have noticed the 'generated' PageDef file entries when you define a Contextual Event using the editor(PS2 release). If you define Contextual Event for a command button, the generated PageDef entries may look like as shown below
<?xml version="1.0" encoding="UTF-8" ?>
<pageDefinition xmlns="http://xmlns.oracle.com/adfm/uimodel"
                version="11.1.1.56.60" id="untitled8PageDef"
                Package="view.pageDefs">
  <parameters/>
  <executables>
    <variableIterator id="variables"/>
  </executables>
  <bindings>
    <eventBinding id="eventBinding"
                  Listener="javax.faces.event.ActionListener">
      <events xmlns="http://xmlns.oracle.com/adfm/contextualEvent">
        <event name="SampleEvent" customPayLoad="Test"/>
      </events>
    </eventBinding>
  </bindings>
  <events xmlns="http://xmlns.oracle.com/adfm/contextualEvent">
    <event name="SampleEvent" customPayLoad="Test"/>
  </events>
</pageDefinition>

You may notice that <events> repeats two times - one under <eventBinding> and another at root level, right inside <pageDefinition>. Please note that, Contextual Event Runtime is interested only in the one which appears inside <eventBinding>. The <events> right inside <pageDefinition> is supposed to be used by design time - while defining Contextual Event using existing events. It acts more like a template. (PS2 release doesn't seems to have this feature, hopefully upcoming release of JDeveloper may have this feature enabled)

Comments