aspose file tools*
The moose likes JSF and the fly likes Difference between binding and value tag Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Java 8 in Action this week in the Java 8 forum!
JavaRanch » Java Forums » Java » JSF
Bookmark "Difference between binding and value tag" Watch "Difference between binding and value tag" New topic
Author

Difference between binding and value tag

Yosi Pramajaya
Ranch Hand

Joined: Jun 30, 2011
Posts: 46

Hey guys, what's the different between binding and value tag?
It's all the same, doesn't it? Modifying and setting the value of a bean property.
What say you?


Independent Programmer - Technology Enthusiast - JUG Leader from JUG Joglosemar
leo donahue
Ranch Hand

Joined: Apr 17, 2003
Posts: 327
I assume you're talking about the difference between these?

The first one is just a value you supply.
The second one is a binding to a value that comes from your bean property.

Thanks, leo
Tim Holloway
Saloon Keeper

Joined: Jun 25, 2001
Posts: 15662
    
  15

I think originally value tags didn't exist and binding was the only choice. Then a bunch of stale web pages kept Binding in view long after it was no longer the best solution.

Binding is a lot more cumbersome than value expressions. It introduces JSF-specific logic and constructs into what would otherwise be POJOs.

There are uses for bindings, however, just not as many as people actually use. Their primary benefit is that if you're not using a static View template, you can bind the View template to an "anchor" object that serves as container for the dynamic components and then construct the dynamic components in a backing bean, attaching them to their bound parent.


Customer surveys are for companies who didn't pay proper attention to begin with.
Yosi Pramajaya
Ranch Hand

Joined: Jun 30, 2011
Posts: 46

Thanks buddy, you both were really helpful.
But, if I want to make this code work :

and then I want to use the facesLogin.name in another page
like this:


How can I do that? xxx will be binding or value tag? or can be both of them?
Tim Holloway
Saloon Keeper

Joined: Jun 25, 2001
Posts: 15662
    
  15



Would be the proper value binding.

Your second example isn't actually JSF, it's EL going directly out to the view, so neither value nor binding apply. In JSF, you'd bind a value property like this:



Or you could split the difference:



That only works on output. Input value expressions have to reference a single property which will then be set when the form is submitted.
Yosi Pramajaya
Ranch Hand

Joined: Jun 30, 2011
Posts: 46

Thank you Tim Holloway,
I think my problem has been resolved.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Difference between binding and value tag
 
Similar Threads
Difference between value attribute and binding attribute
value and binding attribute
Accessing JSF Bean for custom JSP Tag
backing beans vs managed beans
What is the difference between 'deep' and 'shallow' binding?