I am using PrimeFaces 6.0.15 and JSF 2.2. I am currently using the component p:textEditor to allow the user to format text (bold, italics, etc.) For example, if I have bolde and underline content, in the DB it would be stored as: <p><strong><u>TEST</u></strong></p>
.
On the edit mode of my application, I pull the data from the database and because the format is persisted in the DB, it automatically shows the content bolde and underlined. But is there a read only version of the text editor such as but with the textEditor formatting functionality?
Since what is stored on the DB is pure HTML, I tried doing something like:
<h:panelGroup>#{bean.description}</h:panelGroup>
But it displayed this: <p><strong><u>TITLE</u></strong></p>
How could I display the content so that it shows the formatted content?
To enable HTML insertion without escaping, just set the escape
attribute of h:outputText
to false
:
<h:outputText value="#{bean.description}" escape="false" />
Note: Presenting the HTML input of user A to user B may raise security issues (see: cross site request forgery ).
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.