• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Initialization of Managed Bean

 
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi guys,
Just confused the initialization of the managed bean defined in the face-config.xml file. When does the managed-bean actually initialize? is it based on what scope you define for the bean? Like, request-scoped beans only initialize when they are needed in request? session-scoped beans are initialize when a session is created?( and how a session is created? how to know which session they belongs to?) and application-scoped beans are built when the server start? and Can someone tell me about the life-cycle for these beans? thanks~~
 
author and cow tipper
Posts: 5009
1
Hibernate Spring Tomcat Server
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

When does the managed-bean actually initialize



From what I've seen, it's initialized the first time it's needed.

-Cameron McKenzie
 
Saloon Keeper
Posts: 27764
196
Android Eclipse IDE Tomcat Server Redhat Java Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Cameron Wallace McKenzie wrote:

When does the managed-bean actually initialize



From what I've seen, it's initialized the first time it's needed.

-Cameron McKenzie



Correct. Managed beans are created/initialized on demand. Specifically, session and application scope beans are not created when the session or application is first created, but rather when the first attempt to reference them is made in a JSF page request. Which means that if you need these items created in advance, you have to manually construct them in the old-fashioned non-JSF way. Or gimmick up a reference.
 
Ranch Hand
Posts: 327
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks Tim! That was going to be one of my questions today.
 
reply
    Bookmark Topic Watch Topic
  • New Topic