Obtaining an instance of a Managed Bean declared with Application Level Scope
Abiodun Adisa
Ranch Hand
Joined: Jan 17, 2002
Posts: 495
posted
0
I have a managed bean that i have defined with Application Level Scope that means it only gets instantiated once during the life of the application, Now i would like to get a reference to that instance from my Managed bean which has Session Level Scope, Please how do i go about this, and i would not want to say A ab=new A(); as this would create another instance
Ryan Lubke
Ranch Hand
Joined: Jun 20, 2007
Posts: 36
posted
0
Originally posted by Abiodun Adisa: I have a managed bean that i have defined with Application Level Scope that means it only gets instantiated once during the life of the application, Now i would like to get a reference to that instance from my Managed bean which has Session Level Scope, Please how do i go about this, and i would not want to say A ab=new A(); as this would create another instance
Say your application scoped managed bean is called 'app'.
Then in your session managed bean definition you'd:
When 'sessBean' is instaniated by JSF, the application scoped bean will be injected into the instance. You need to make sure there is public property accessors for this to work of course.
Abiodun Adisa
Ranch Hand
Joined: Jan 17, 2002
Posts: 495
posted
0
Originally posted by Ryan Lubke:
Say your application scoped managed bean is called 'app'.
Then in your session managed bean definition you'd:
When 'sessBean' is instaniated by JSF, the application scoped bean will be injected into the instance. You need to make sure there is public property accessors for this to work of course.
Hello, I did it as you suggested but it did'nt work, I am posting my code probably i missed something