How can I show text with html tag in mode

I get the line from < p:editor> as follows: < b>This is bold text< /b> . I want to show <b>This is bold text</b> in the xhtml page. Which tag can I use for this?

+6
source share
1 answer

Use the output text with escape="true" :

 <h:outputText escape="true" value="<b>This is bold</b>"/> 

As stated in the answer to this question :

... Facelets implicitly wraps the inline content [cursor] in the component represented by <h:outputText>

So, if you do not use the outputText tag with the escape attribute set to true , Facelets will add for you , which will supplant the html tags.

Edit: I am completely mistaken in the escape attribute. Please forgive my ignorance as I am still participating. According to the documentation, the escape attribute:

A flag indicating that characters sensitive to HTML and XML markup should be escaped. By default, this flag is set to true.

For a correct example, see the answer to this OS question .

+15
source

Source: https://habr.com/ru/post/899855/


All Articles