I make heavy use properties from bundles in my application as I strive to keep code maintainable in future. Because of this all HTML text is fetched from a key/value properties file eg. 'index_en.properties'
This has become problematic where I need the browser to render bold text and I don't find any topics online that address this problem.
Best solution I can then up would be to break every fetched value down with use of the
<h:outputText> tags that are child elements of the `<b>` tags.
What I need here is a methodology/tips/solution from someone who uses property files often.
I tried using html escape codes directly in the properties file, but this does not work.
Any tips?
Thank you, Yucca
PS I doubt CSS will help me here.
Put HTML <b>
in bundle and use escape="false"
on <h:outputText>
to disable standard HTML escaping by the component:
<h:outputText value="#{msg.text}" escape="false" />
Be sure that you never do this on user-controlled input as it would put XSS attack holes open. Also be sure that you don't go overboard with putting HTML in bundles. For basic text formatting with <b>
, <u>
, <i>
, <s>
and so on it's okay, but not for semantic markup like <p>
, <div>
, <h1>
, etc.