Skip to content Skip to sidebar Skip to footer

Do Not Collapse Whitespace When Displaying The Value Of The Backing Bean In The Jsf

I found that the backing bean value displayed on the JSF page will collapse the white-space automatically .How can I make the value displayed do not collapse the white-space?? For

Solution 1:

This is not specific to JSF. This is specific to HTML

You can fix it by either putting it in a HTML <pre> element:

<h1><pre>#{bean.text}</pre></h1>

Or by applying CSS white-space: pre on the HTML element:

h1 { 
    white-space: pre;
}

(as you see, it also occurs on your question here on Stackoverflow as well, since it also doesn't preserve whitespace by white-space: pre)

Solution 2:

Sun's JavaServer Faces implementation (1.2_07-b03-FCS) has the same issue on Webshpere Application Server 7.0.0.21 for the CSS white-space: pre

Post a Comment for "Do Not Collapse Whitespace When Displaying The Value Of The Backing Bean In The Jsf"