Multi-line value in Resource.properties file?

java, jsf, jsf-2

Solution

You have to use backslash (`\`) at the end of the line. This question was already asked here.

Your problem is probably because HTML doesn't care about new line. If you want to display a new line you have to use the `<br />` tag.

You can include HTML code in your properties file and the use the `escape="false"` to avoid escaping the HTML tags when generating the HTML.

TXT_ABOUT = first line<br />\
    second line<br />\
    third line.

JSF code:

<h:outputText value="#{txt.TXT_ABOUT}" escape="false" /> 

Problem

I have a multi-line value in `Resource.properties` file: ``` TXT_ABOUT = first line \ second line \n \ third line. ``` I am displaying this in the About box: ``` <h:outputText value="#{txt.TXT_ABOUT}"/> ``` (The `txt` is defined via `faces-config.xml`: ``` <resource-bundle> <base-name>com.compayn.etcetc.Resources</base-name> <var>txt</var> </resource-bundle> ``` but this is not important for the question.) The problem is: new line marks in the variable definition are not shown on the rendered page, it's all in one row. Is this syntax above OK? Is `\n` OK?

Original source

Related problems