Instead of staring at JSF source code, you should first investigate how the generated HTML output should look like in order to achieve the concrete UI requirement. In plain HTML terms, you can achieve that by either putting the text content in a HTML <pre>
element, or to apply CSS white-space:pre
style on the parent element.
None of them have a JSF component equivalent. But that's also not necessary. You can just write HTML and CSS the usual way in JSF.
<pre><h:outputText value="#{item.text}" /></pre>
or
<h:outputText value="#{item.text}" style="white-space: pre;" />
(note: above example is intented as kickoff, normal practice is to use a normal CSS class)
. But your answer is much simpler (and better).
– Tony Sep 16 '13 at 14:40` doesn't preserve formatting. It has semantically also a different meaning (a paragraph).
– BalusC Sep 16 '13 at 14:45