aspose file tools*
The moose likes JSF and the fly likes Use of h:outputLabel Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » JSF
Bookmark "Use of h:outputLabel" Watch "Use of h:outputLabel" New topic
Author

Use of h:outputLabel

Ram Chhabra
Ranch Hand

Joined: Jan 07, 2008
Posts: 48
Hi,

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

Thanks,
Ram
Krishna Srinivasan
Ranch Hand

Joined: Jul 28, 2003
Posts: 1844

when you use output label, the value is enclosed with <label>. I don't see many differences.


Krishna Srinivasan
Spring Tutorials, OCAJP Mock Questions, 400+ OCPJP Mock Questions
Dushyant Agarwal
Ranch Hand

Joined: Oct 14, 2007
Posts: 75
Hi,
You might have noticed the "for" attribute in outputlabel. It is not present in
outputText.
Tim Holloway
Saloon Keeper

Joined: Jun 25, 2001
Posts: 16145
    
  21

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.


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

Joined: Oct 14, 2007
Posts: 75
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??
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: Use of h:outputLabel