It's not a secret anymore!
The moose likes JSF and the fly likes JSF : Component Binding Vs find component in the tree Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » JSF
Bookmark "JSF : Component Binding Vs find component in the tree" Watch "JSF : Component Binding Vs find component in the tree" New topic

JSF : Component Binding Vs find component in the tree

md mdmeraj

Joined: Dec 01, 2009
Posts: 1
what is better approach, component Binding or finding component in the component tree.
I am bit confused. Some where it is mentioned that component binding is more effecient as because, we dont need to find any component in the tree.

But I got some information from some JSF expert they dont recomend to have compoent binding as because the life cycle of managed bean and component tree is diffrent. that means if we used a component binding inside a manged bean, garbage collection of the component will depends on the managebean , as because component is referenced inside the managed bean , managed bean is having longer life than component inside a tree.
please advice.
Rainer Eschen
Ranch Hand

Joined: Jan 24, 2009
Posts: 75
You start to think about optimization before your project has problems with it.

Although I prefer value binding I have code contexts that also use component binding. Use it if you need it or your design is more understandable with it. The quality in design, code readability and maintainability are more important in the long run.

The hardware will become cheaper during your project. So speed, memory usages and the like problems you may expect at the beginning of a project become less important with the better hardware quality at the end of your project ;-). A bad design will cost you more in the long run.

ICEfaces book . ICEcube . ICEfusion . Scrum
Tim Holloway
Saloon Keeper

Joined: Jun 25, 2001
Posts: 17417

I've seen component binding and listeners overused. I certainly wouldn't use them purely for efficiency's sake, since if there's that big a performance problem, I might end up re-engineering the offending part of the app to use non-JSF techniques and bypass the overhead that comes from setting up and tearing down a FacesContext and its friends.

The major selling point of JSF to me is that it allows creating webapps out of simple, reusable components in a fairly straightforward way. To employ complex or even convoluted specialized JSF features in those components would be defeating fully half the purpose. So I bind to values, do injections, and avoid listeners except when there's a good reason to do otherwise.

An IDE is no substitute for an Intelligent Developer.
I agree. Here's the link:
subject: JSF : Component Binding Vs find component in the tree
It's not a secret anymore!