Win a copy of Design for the Mind this week in the Design forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

JSF bean container

 
Kumaravadivel Subramani
Ranch Hand
Posts: 171
Java Linux Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi All,
I'm a newbie for JSF and very much interested to know about the JSF internal processing. By the way I've a doubt about the JSF bean container, Is it uses any internal container or EJB's one?
Since JSF able to process managed bean it should be any container to process beans. I just searched for it and not able to find the exact answer and seen somewhere Inversion of control like that.

Kindly help me on this. Thanks in advance.
 
Tim Holloway
Saloon Keeper
Pie
Posts: 18094
48
Android Eclipse IDE Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Jsf doesn't actually have a bean container. JSF's backing beans are simply standard J2EE beans. So a JSF request-scope object is part of the HttpServletRequest attributes collection, a session-scope object is part of the HttpSession attributes, and an application-scope managed bean is stored as an application attribute. These objects are equally accessible via both traditional Java code and JSF, which makes it easy to pass stuff back and forth, for example, when a JSF view initiates the generation of a PDF from a PDF-generating servlet, the JSF can store generation info in a session bean which the generating servlet can then consume.

The only real difference between JSF Managed Beans and traditional J2EE beans is that Managed Beans are defined with the information necessary for JSF to construct and wire together the beans itself instead of making you write your own code to do it. That's part of the Inversion of Control paradigm, and if you're not familiar with IoC, please do read up on it. It's not just a part of JSF - it's a general technique for promoting code reuse and flexibility. For example he Spring Framework is a system that can be used in a variety of environments to do IoC bean construction and cross-connection.
 
Kumaravadivel Subramani
Ranch Hand
Posts: 171
Java Linux Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks Tim, really that was a awesome response and I've another question to ask you.

"Inversion of Control usually refers to the "containers" while Dependency Injection refers to the actual pattern"???
 
Tim Holloway
Saloon Keeper
Pie
Posts: 18094
48
Android Eclipse IDE Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Kumaravadivel Subramani wrote:
"Inversion of Control usually refers to the "containers" while Dependency Injection refers to the actual pattern"???


I don't know if IoC qualifies as a true pattern, anymore than MVC does. However, IoC is the name of the strategy and Dependency Injection is one of its primary functions.

For any definitions more precise than that, you're best off consulting the academicians.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic