Skip to main content

Difference between Component Binding and Value Binding

Please note these java.net forums are being decommissioned and use the new and improved forums at https://community.oracle.com/community/java.
3 replies [Last post]
prithvisehgal
Offline
Joined: 2011-02-05

Hello,
I am very glad to join this new forum. I am pretty much new to JSF 2.0. I have tried to seek out the difference of this
concept on many other forums also but no luck. I want to know whats the difference between component binding and
value binding?
BR,
Prithvi

Reply viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
tiefflieger
Offline
Joined: 2009-01-29

component binding gives you full controll over the component, ie all of its attributes and so on. Value Binding gives you controll over just one single specific part of that component.

I know this explanation is flawed, but I like to keep things as simple as can be.

prithvisehgal
Offline
Joined: 2011-02-05

Hi tieff
Thankyou so much for your simple explanation. It has helped me viewing component binding not as a giant. My another
concern is, is JSF lifecycle treats both component binding and value binding similarly or differently?
BR,
Prithvi

tiefflieger
Offline
Joined: 2009-01-29

I'm not a JSF expert, but I think that should be the same, as far as calling of getters and setters of the underlying model is concerned. But you could check that by adding
System.err.println(FacesContext.getCurrentInstance().getCurrentPhaseId())
to these getters and setters. Nevertheless, using component binding you can change the component's behaviour in the rplc, e.g. by attaching an actionListener.