html - Replace spaces with nonbreakable spaces in JSF -
this question has answer here:
i need jsf 2.1.29 advise. have following using of bean's property:
#{somebean.someproperty} where #{somebean.someproperty} returns 7 8 (note number of spaces between digits). , in browser it's displayed 7 8. when replace spaces , displayed is:
7 8 how can display 7 8?
that html escaping @ work, enabled default. disable using escape attribute:
<h:outputtext escape="false" value="#{backingbean.sometext}"/> i tested this, , outputs 7 8 when backing bean returns 7      8.
alternatively, use css white-space property preserve plain (not non-breaking) white spaces:
<h:outputtext value="#{backingbean.sometext}" style="white-space: pre"/> the css solution better, maintains xss protection.
Comments
Post a Comment