Is it possible to get HTML code that is inside a bean variable and print it in the Facelets file as HTML code and not as text?
Example:
myBean.java
public String getMyHtmlCode(){
return "<span class="little">Internet</span> 100Mb <span class="little">+television</span>"
}
file.xhtml
<h2>#{myBean.myHtmlCode}</h2>
But in the navigator appears
<span class="little">Internet</span> 100Mb <span class="little">+television</span>
And is not interpreted as html.
Any idea?
In BalusC words from his comment:
(You) should just disable the default escaping of the text
<h2>
<h:outputText value="#{myBean.myHtmlCode}" escape="false" />
</h2>
Just note that this code is prone to XSS attacks.