Frage

I have a JSF page where I display data from different rss feeds. Sometimes this data contains html markup elements, but when I put them inside a p:outputLabel they are displayed on the page like plain text filled with markup elements written out. Is there a way to either ignore these elements or to render them properly? Unfortunately I haven't found much on this.

War es hilfreich?

Lösung

Set the escape attribute for the control to false. The default is true to prevent interpretation of any content as html.

<p:outputLabel value="#{bean.text}" escape="false"/>

Andere Tipps

Use escape="true" in <h:outputText>:

<h:outputText value="#{bean.text}" escape="true" />

Note that <p:outputLabel> will render a <label> HTML commponent, which should be used as label for other components like <p:inputText>. It is not for writing direct content in your HTML.

Lizenziert unter: CC-BY-SA mit Zuschreibung
Nicht verbunden mit StackOverflow
scroll top