7

I have what it seems to be a very trivial question for you jsf expert out there... I'm working in a JSF 2.0 application. Said that I have managed bean with a property containing an html portion to display to the user, which faces control should I use to emit that html directly on the page, without encoding it?

1 Answer 1

25

Did you try that:

<h:outputText value="#{myBean.myProperty}" escape="false"/>

By default, escape attribute is set to true in order to escape the HTML / XML characters.

Sign up to request clarification or add additional context in comments.

2 Comments

I found out also that using <f:verbatim>#{myBean.myProperty}</f:verbatim> do the job. What's the best way? Any problem with one of the 2 solutions?
<f:verbatim> had a special purpose in JSF 1.x which is not necessary anymore in JSF 2.x and is been deprecated since JSF 2.1. Don't use it.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.