• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Difference Between outputText and outputLabel

 
Abiodun Adisa
Ranch Hand
Posts: 495
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 17278
6
IntelliJ IDE Mac Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
They produce different HTML, such that there are also different properties that you can set on it.

Sorry for being so brief.

Mark
 
Yasir Bajwa
Greenhorn
Posts: 23
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 495
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 29
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
outputlabel is also used automatically for validation errors
 
Seetharaman Venkatasamy
Ranch Hand
Posts: 5575
Eclipse IDE Java Windows XP
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
DontWakeTheZombies!
Please start a new thread
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic