File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes JSF and the fly likes Difference Between outputText and outputLabel Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of OCA/OCP Java SE 7 Programmer I & II Study Guide this week in the OCPJP forum!
JavaRanch » Java Forums » Java » JSF
Bookmark "Difference Between outputText and outputLabel" Watch "Difference Between outputText and outputLabel" New topic
Author

Difference Between outputText and outputLabel

Abiodun Adisa
Ranch Hand

Joined: Jan 17, 2002
Posts: 495
Please i want to know what is the difference between <hutputText> and <hutputLabel>, to me they accomplish the same and i don't really know when to use which
Mark Spritzler
ranger
Sheriff

Joined: Feb 05, 2001
Posts: 17258
    
    6

They produce different HTML, such that there are also different properties that you can set on it.

Sorry for being so brief.

Mark


Perfect World Programming, LLC - Two Laptop Bag - Tube Organizer
How to Ask Questions the Smart Way FAQ
Yasir Bajwa
Greenhorn

Joined: May 02, 2007
Posts: 23
hutputText is for just that, text output, but keep in mind this will output text for html by default so it escapes characters as needed

hutputLabel is intented to act as a label, for example, with an h:inputText control -- example
<hutputLabel for="myinputid">Label Text:</hutputLabel>
<h:inputText id="myinputid" value="#{mybean.property}" />

would generate html something like:

<label for="myinputid">Label Text:</label>
<input id="myinputid" type="text" name="myinputid" />
Abiodun Adisa
Ranch Hand

Joined: Jan 17, 2002
Posts: 495
Originally posted by Yasir Bajwa:
hutputText is for just that, text output, but keep in mind this will output text for html by default so it escapes characters as needed

hutputLabel is intented to act as a label, for example, with an h:inputText control -- example
<hutputLabel for="myinputid">Label Text:</hutputLabel>
<h:inputText id="myinputid" value="#{mybean.property}" />

would generate html something like:

<label for="myinputid">Label Text:</label>
<input id="myinputid" type="text" name="myinputid" />


thanks for your answer I have been using both of them without knowing the reason mainly because they produce identical output to me but since i now know the difference I would know when to use and when not to use
Leonardo Shikida
Greenhorn

Joined: Jan 02, 2003
Posts: 29
outputlabel is also used automatically for validation errors
Seetharaman Venkatasamy
Ranch Hand

Joined: Jan 28, 2008
Posts: 5575

DontWakeTheZombies!
Please start a new thread
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Difference Between outputText and outputLabel