Thursday, April 21, 2011

Jsf control that format text with html tags

Good morning all.

Is there any jsf control that escapes the html tags?

Imagine that i have the following string in resources:

text.String=lalala<br/>lelele

and i want to print it on Xhtml file with a simple control like:

<h:outputText value="#{messages['text.String']}" />

how do i get the result formatted with the html <br/> tag? Result should be:

lalala
lelele

instead of:
lalala<br/>lelele

Thanks

From stackoverflow
  • Hi,

    the outputText control has an 'escape' property which controls that behaviour. See here (outputText reference).

    So basically:

    <h:outputText escape="false" value="#{messages['text.String']}" />
    

    should do the job.

0 comments:

Post a Comment