• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

difference between value and binding

 
Higgledy Smith
Ranch Hand
Posts: 192
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I am new to JSF and am using ICEFaces v1.8.

Most ICEFaces components have a binding attribute and a value attribute. Can anyone explain the difference between these two attributes?

From the ICEFaces API for ice:inputText, here is the definition given:

binding - The value binding expression linking this component to a property in a backing bean

value - The current value of this component. All UIInput derived UIComponents, that are placed within a UIData container, such as a dataTable or panelSeries, should have their value attribute bound to a bean property via a ValueBinding/ValueExpression, since otherwise the UIData container will not keep their successfully validated state, which can cause the component to fail to function properly.



 
Rahul Mishra
Ranch Hand
Posts: 211
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
This has got to be one of the most famous all time questions on JSF...

i asked the same question when i started...anyway..here goes your answer..


When you are interested in only the value of a UI element...(the text it holds)..use the value attribute...
When you are interested in the backing the UI element itself , for example, to set the visibility of the UI element in your controller..use binding attribute...because a value attribute will not give you access to the UI element in the backing bean...

To gain further insight into the above explanation..define two UI elements in a JSP...back one using the 'value' attribute and the other using the 'binding' attribute...notice how the 'types' of these attributes differ in the backing bean...and you will have your answer..

Cheers
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic