Thursday, January 27, 2011

Backing Bean Scope

What is a key difference between JSF request scope and ADF backing bean scope?

Well, the "lifetime" of these two scopes is exactly the same. However if you need to create a backing bean for an ADF declarative component, the you will need to use backing bean scope for that managed bean. This enables using multiple instances of your declarative component in a single ADF page...something which the JSF request scope does NOT support.

(Please see the comments on this blog entry for an additional function of Backing Bean Scope as relates to regions and bounded task flows; many thanks to Chris Muir for pointing these things out.)

7 comments:

Chris Muir said...

Hi Michael

My understanding this also extends to any BTF included in a region on a page. If the BTF refers to a bean it should either be in pageFlowScope or backingBeanScope, as with regards the later, the same BTF can be included in the consuming page more than once.

CM.

Michael A. Fons said...

Thank you very much for your comment Chris. I am sure you are right about this further use of the backingBeanScope. I am digging into ADF Faces 11g with renewed vigor due to impending demands at work, so I am very interested in these sorts of details and becoming one with the whole of this technology. (Although this weekend I will be desperately trying to finish my JSF 2.0 presentation as I am presenting it for NoVAJUG on 2/9/2011 in Reston, VA)

BTW, for anybody reading this who does not know, BTF stands for Bounded Task Flow, an amazing facility in ADF for enabling all sorts of good things in ADF applications.

Chris Muir said...

Good stuff Michael. You might be interested in a thread about bean scopes conducted on the ADF EMG sometime back, with the importance of getting scope right: http://groups.google.com/group/adf-methodology/browse_thread/thread/c7427b4b0b69766d

Good luck with your NoVAJUG presentation.

CM.

suryaworldedu said...

good stuff

Michael A. Fons said...

Thanks again, Surya!

Zinov said...

Hi I am new in adf, I am trying to insert a backing bean to my declarative component, I want to create a java class a bind a method of my declarative component to another in that java class, and I want to access to attributes of my declarative component, something like this

class MyClass(){
public void MyMethod(parametersHere){
myDeclarativeComp.attr1. .....
}
}

Is this posible?
Regards Zinov

Michael A. Fons said...

Can you use the "binding" attribute to give you access to the component? Or am I missing something?