my dog learned polymorphism*
The moose likes JSF and the fly likes what is the use of binding attribute in jsf component tags Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of OCA/OCP Java SE 7 Programmer I & II Study Guide this week in the OCPJP forum!
JavaRanch » Java Forums » Java » JSF
Bookmark "what is the use of binding attribute in jsf component tags" Watch "what is the use of binding attribute in jsf component tags" New topic
Author

what is the use of binding attribute in jsf component tags

ali honarmand
Ranch Hand

Joined: Oct 12, 2009
Posts: 32

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?


A. Honarmand
Tim Holloway
Saloon Keeper

Joined: Jun 25, 2001
Posts: 16158
    
  21

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.


Customer surveys are for companies who didn't pay proper attention to begin with.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: what is the use of binding attribute in jsf component tags