Win a copy of Re-engineering Legacy Software this week in the Refactoring forum
or Docker in Action in the Cloud/Virtualization forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

what is the use of binding attribute in jsf component tags

 
ali honarmand
Ranch Hand
Posts: 32
Java Netbeans IDE Oracle
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
I want to know what is the use of binding attribute of the jsf component tags and it's difference
with using value attribute to access a backing bean property.

can anyone help?
 
Tim Holloway
Saloon Keeper
Pie
Posts: 18012
47
Android Eclipse IDE Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Binding is often mis-used. I think that there is old stale documentation out on the Internet that people keep reading. And maybe 1 or 2 really rude IDEs that generate binding code as an "easy way out".

in 99% of the cases, getting and setting a control's value via the "value=" attribute and POJO getter/setter code is all that anyone ever needs.

What binding is good for is when you have a need to dynamically modify the UI component object tree at a very low level, since the bound method is passed the control's UIComponent object as a parameter.

A lot of "dynamic" modifications don't need that, since things like control captions, rendered, enable/disable, number of rows in a table and so forth can be controlled via EL expressions in attributes and/or changes to model data. I've done more more JSF webapps than I can think of and can only recall one app where they weren't enough and I had to resort to binding.

Mostly you'd bind to a control that was a parent of other controls in order to do coarse-grained UI arrangements of that control's child UI components in cases where a ui:repeat or datatable can't manage, since like I said, the majority of the things you'd do directly to a control have much simpler POJO-based mod mechanisms.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic