This week's book giveaway is in the Agile and other Processes forum.
We're giving away four copies of The Mikado Method and have Ola Ellnestam and Daniel Brolund on-line!
See this thread for details.
The moose likes Struts and the fly likes To Authors: Difference between Value Binding and Component Binding Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login


Win a copy of The Mikado Method this week in the Agile and other Processes forum!
JavaRanch » Java Forums » Frameworks » Struts
Reply Bookmark "To Authors: Difference between Value Binding and Component Binding" Watch "To Authors: Difference between Value Binding and Component Binding" New topic
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")
 
I agree. Here's the link: http://ej-technologies/jprofiler - if it wasn't for jprofiler, we would need to run our stuff on 16 servers instead of 3.
 
subject: To Authors: Difference between Value Binding and Component Binding
 
Similar Threads
difference between value and binding
Difference between value attribute and binding attribute
Which Binding Type Do You Prefer And Why
What is the difference between 'deep' and 'shallow' binding?
backing beans vs managed beans