• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

JSF : Component Binding Vs find component in the tree

 
md mdmeraj
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
Thanks
Meraj
 
Rainer Eschen
author
Ranch Hand
Posts: 75
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
Tim Holloway
Saloon Keeper
Pie
Posts: 18098
50
Android Eclipse IDE Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic