Win a copy of Think Java: How to Think Like a Computer Scientist this week in the Java in General forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Use of h:outputLabel

 
Ram Chhabra
Ranch Hand
Posts: 48
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

When we have hutputText with us , then whats the use of hutputLabel.

Thanks,
Ram
 
Krishna Srinivasan
Ranch Hand
Posts: 1862
Firefox Browser Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
when you use output label, the value is enclosed with <label>. I don't see many differences.
 
Dushyant Agarwal
Ranch Hand
Posts: 75
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
You might have noticed the "for" attribute in outputlabel. It is not present in
outputText.
 
Tim Holloway
Saloon Keeper
Pie
Posts: 18152
52
Android Eclipse IDE Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
JSF is a specification language first and a markup language secondly. It's possible to attach alternative renderers to a JSF app for cases where HTML isn't the desired output - for example, an XML markup language like WAP or even PostScript (a la the old NeXt computers). Or really unique displays using unusual hardware.

By having the label "for=" attribute, you're logically binding the label to the data control regardless of its physical relationship in the original JSF, and you're saying that it's a label as opposed to generic text (maybe the custom display has the labels permanently printed on the faceplate so the labels don't need to render, but the data might need to be re-arranged to match).

It adds a little flexibility and portability.
 
Dushyant Agarwal
Ranch Hand
Posts: 75
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
you're logically binding the label to the data control regardless of its physical relationship in the original JSF,


Please Explain!!

It adds a little flexibility and portability.

Please specify how??
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic