2 Replies Latest reply on Apr 6, 2010 9:23 AM by Frank Nimphius-Oracle

    Data sharing between region and the ADF page which contains it

    758485
      Here I've got an ADF page, on which there is a region. Suppose the region corresponds to the backing bean A and the ADF page corresponds to backing bean B. Now I need to make use of the variable (e.g., var_a) in the region the pass it to the backing bean of the ADF Page's backing bean B.

      How do I achieve this? Any comments will be highly appreciated.

      Regards.

      Edited by: isaacniu on Apr 5, 2010 8:05 PM
        • 2. Re: Data sharing between region and the ADF page which contains it
          Frank Nimphius-Oracle
          Hi,

          the propery way to communicate back fom a region into the calling page is to use contextual events, which is a publish/subscribe system implemented on teh ADF binding layer. If a bean is configured in a standrad servlet scope (for example request or session), thus not bound to a specific occurence of its instance (backingBeanScope) then you could pass the EL string as an input argument to the task flow and use a ValueExpression in the managed bean of the region to resolve it and call a setVariable method to pass a value to it.

          For example, if the managed bean is MyManagedBean, then you could pass

          #{'#{MyManagedBean}'}

          as the task flow input value. This then e.g would be written to the pageFlowScope.externalBeanref attribute (you need to do this in the input parameter mapping) from where it can be accessed by the inner managed bean (the bean of the region).

          Note that the above is a "little dirty" but works. The reason why I suggest to use an input parameter instead of directly coding the EL to the parent page managed bean into the bean of the region is encpsulation: you don't want to make the bounded task flow in the region dependent from the outer parent context.

          Frank

          Ps.: Note that the managed bean is created when it does not exist. If you want to avoid this, you could pass #{'#{requestScope.managedBean}'} into the task flow. In this case, if the managed bean is not instantiated by the parent, the EL Value Expression comes out "null" if the managed bean wasn't instantiated before, in which case you know that there is no sense in accessing a setter/getter on it.