Should I use <h:outputText value="static text"/>
or directly write static text
into the xhtml
file to print text that is static?
Example - with output text:
<h:outputText value="User Name:"/>
<h:outputText value="#{currentUser.name}"/>
Example - directly:
User Name:
<h:outputText value="#{currentUser.name}"/>
Just write it directly into the page without the outputText. You even can write el expressions without a tag. So you could write:
User name: #{currentUser.name}
The outputText is needed (among others) if you want to change the text with ajax, render it conditionally or if you want to apply certain styles to the text.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With