This week's book giveaway is in the General Computing forum. We're giving away four copies of Arduino in Action and have Martin Evans, Joshua Noble, and Jordan Hochenbaum on-line! See this thread for details.
I have some application-scoped managed beans that I'm defining in my faces config file. So far, so good, that's all standard. But I'd like them to be instanciated at application start-up, rather than later when they happen to be first referenced. Is there a standard way to trigger their creation at application start-up?
I suppose you could create a context listener that you map in your web.xml and you could instantiate and throw all the managed beans into app scope. Just make sure you give them the same reference name as you do in your managed bean.
Hank
Jeff Albertson
Ranch Hand
Joined: Sep 16, 2005
Posts: 1780
posted
0
Originally posted by Henry Lowell: I suppose you could create a context listener that you map in your web.xml and you could instantiate and throw all the managed beans into app scope. Just make sure you give them the same reference name as you do in your managed bean.
I think the problem with using a context listener is that if I try to get the FacesContext in it:
And if I just directly instantiate my classes and add them to the application scope, I will be missing out on all the managed property values I define in my faces-config.xml, which is the whole reason I'm going through this execise! So this approach doesn't seem hopeful.
P.S: I was going to try it out, but because of a change in the technical architecture, I didn't had the necessity to try it. Please let us know if the above idea worked out for you.
Jeff Albertson
Ranch Hand
Joined: Sep 16, 2005
Posts: 1780
posted
0
Originally posted by g madhava: Take a look at the below link,it gives you an idea of how to get a handle on the FacesContext.
P.S: I was going to try it out, but because of a change in the technical architecture, I didn't had the necessity to try it. Please let us know if the above idea worked out for you.