Search code examples
spring-securityckeditorjsoupspring-4

HTML retrieved from database does not appear correct


I am creating an application using Spring4/JPA/JSoup/Ckeditor.

User logins->opens a page->enters text using ckeditor->publishes it (kind of a small blog).

Data is saved successfully in mysql database, so for example:

  1. User enters a bold text in ckeditor and it gets saved as

<p><strong>Bold</p></strong>

  1. But when I launch the view page(jsp) this data appears along with html tags as it is from the database, like this :-

<p><strong>Bold</p></strong>

For correct behaviour it should have displayed like - Bold

When i view source of jsp page, html saved in database appears there as below Output from

&lt;p&gt;&lt;strong&gt;Bold&lt;/strong&gt;&lt;/p&gt;

Could you please help me out in this, I am not able to find where the conversion of <> to

&lt; &gt;

is taking place?

Thanks


Solution

  • Adding below code in jsp worked

    <c:out escapeXml="false" value="${ticket.body}" />