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 JSF bean container Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


JavaRanch » Java Forums » Java » JSF
Bookmark "JSF bean container" Watch "JSF bean container" New topic
Author

JSF bean container

Kumaravadivel Subramani
Ranch Hand

Joined: Jul 05, 2008
Posts: 166

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.


No pain, No gain.
OCJP 1.6
Tim Holloway
Saloon Keeper

Joined: Jun 25, 2001
Posts: 16095
    
  21

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.


Customer surveys are for companies who didn't pay proper attention to begin with.
Kumaravadivel Subramani
Ranch Hand

Joined: Jul 05, 2008
Posts: 166

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

Joined: Jun 25, 2001
Posts: 16095
    
  21

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.
 
jQuery in Action, 2nd edition
 
subject: JSF bean container