Search code examples
richfacesrich-text-editor

Show HTML content from rich:editor


I am using rich:editor feature and also able to get the HTML content when user enters data in the editor.

But the question is : Now I have to display the same HTML content back to user. How would I do that.

i.e if I have entered some bold characters in editor, bean property will contain "<strong>bold</strong>" as string.

But when displaying to user, I should not show him those HTML tags rather show him the data as bold.

I did something like : "<span>#{testplannerBean.description}</span>" but it displays along with the HTML tags as in image.

editor with html tags


Solution

  • I had to use h:outputText like this : <h:outputText value="#{testplannerBean.description}" escape="false"></h:outputText>

    which escapes the content sensitive to HTML