This week's book giveaway is in the Mac OS forum.
We're giving away four copies of a choice of "Take Control of Upgrading to Yosemite" or "Take Control of Automating Your Mac" and have Joe Kissell on-line!
See this thread for details.
The moose likes JSF and the fly likes Managed Bean Life cycle Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


JavaRanch » Java Forums » Java » JSF
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
GenRocket Founder
Ranch Hand

Joined: Jul 11, 2001
Posts: 15299
    
    6

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


GenRocket - Experts at Building Test Data
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!
 
GeeCON Prague 2014
 
subject: Managed Bean Life cycle