| Author |
To Authors: Difference between Value Binding and Component Binding
|
Varun Khanna
Ranch Hand
Joined: May 30, 2002
Posts: 1400
|
|
I can't see much difference between "value" and "binding" attribute apart from the fact that later one provides me the full component in at the server side. Though I have read at many places that it's a cleaner way of getting access to whole component, but is that it's meant for? Can there be a scenario when I should go for component binding rather than value binding ? [ December 15, 2004: Message edited by: K Varun ]
|
- Varun
|
 |
Varun Khanna
Ranch Hand
Joined: May 30, 2002
Posts: 1400
|
|
How about this scenario: <h:inputText binding="My own sub-class of input Text"> Will this work, (Based on old java concept: Parent can reference a child object)?
|
 |
Gregg Bolinger
Ranch Hand
Joined: Jul 11, 2001
Posts: 15230
|
|
Originally posted by K Varun: How about this scenario: <h:inputText binding="My own sub-class of input Text"> Will this work, (Based on old java concept: Parent can reference a child object)?
In theory that should work as long as the parent class is HtmlInputXxxx. The only times I have ran into the need for component binding is if I need to manipulate a component when an ActionEvent is triggered. For example, say I need to disable a component based on a value selected from a HtmlSelectOneMenu component. On the valueChangeListener method I would need access to the component via java code, thus the component binding. Yes, I know you could just adjust a flag and use the disabled="#{..}" but it was just an example.  [ December 15, 2004: Message edited by: Gregg Bolinger ]
|
 |
Varun Khanna
Ranch Hand
Joined: May 30, 2002
Posts: 1400
|
|
Originally posted by Gregg Bolinger: The only times I have ran into the need for component binding is if I need to manipulate a component when an ActionEvent is triggered.
Yeah that's an option, though you can use this approach too to get the component : FacesContext.getCurrentInstance().getViewRoot().findComponent("your component Id")
|
 |
 |
|
|
subject: To Authors: Difference between Value Binding and Component Binding
|
|
|