• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

To Authors: Difference between Value Binding and Component Binding

 
Varun Khanna
Ranch Hand
Posts: 1400
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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 Khanna
Ranch Hand
Posts: 1400
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 15304
6
Chrome IntelliJ IDE Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 1400
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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")
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic