aspose file tools
The moose likes JSF and the fly likes Managed Bean Life cycle Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login


Win a copy of The Mikado Method this week in the Agile and other Processes forum!
JavaRanch » Java Forums » Java » JSF
Reply Bookmark "Managed Bean Life cycle" Watch "Managed Bean Life cycle" New topic
Author

Managed Bean Life cycle

Ramaguru Ramasubbu
Greenhorn

Joined: Feb 09, 2006
Posts: 4
Hi
Just wondering when does an object for the managed bean with session scope get created.
If I have 2 jsp pages and both of the uses the same bean(with session scope), does the constructor of the managed bean called twice?
For example I have a page which has 2 Frames. And the jsps of both the Frame refer to the diffrent properties of the same bean. How many times the constructor of the bean is called?
And How to get and set the current value of one bean's property from the other bean?

Thanks in advance
Ramaguru
Gregg Bolinger
Ranch Hand

Joined: Jul 11, 2001
Posts: 15230

If the managed bean is in session scope and both pages are referencing the same bean, the constructor only gets called once.
Jeff Albertson
Ranch Hand

Joined: Sep 16, 2005
Posts: 1780
As for the second half of your question, it's common to "inject" one bean into another in the config file:

This is like writing:

so in your Java code, the orange object is able to send messages to the apple object.


There is no emoticon for what I am feeling!
 
I agree. Here's the link: http://ej-technologies/jprofiler - if it wasn't for jprofiler, we would need to run our stuff on 16 servers instead of 3.
 
subject: Managed Bean Life cycle
 
Similar Threads
How get session mb in POJO?
Backing bean scope problem
Reentrant page question.
Obtaining an instance of a Managed Bean declared with Application Level Scope
JSF backingbean value is null always.