Note that there are some explanatory texts on larger screens.

plurals
  1. POHow to store a html string in database without its symbols conversion in Java
    primarykey
    data
    text
    <p>I am using ck editor at UI side to send some text to backend in html format(as a string). In this process I am using a JSON that will carry all the necessary key values to service. From UI it the post will carry following data:</p> <pre><code>{ "payload": { "title": "Some title", "categoryId": 64, "richContent": "&lt;p&gt;\n\this is the content that need to be stored in the database&lt;/p&gt;\n", "goLiveOn": 1388219580000, "id": 150 } } </code></pre> <p>when it reaches the service method I am retrieving the JSON object like this:</p> <pre><code>@POST @RestService(input = Article.class, output = Boolean.class) @ServiceStatus(value = "complete") @Consumes(MediaType.APPLICATION_JSON) @Produces(MediaType.APPLICATION_JSON) @Path("/save") public String save(@Context HttpHeaders headers, @Context UriInfo uriInfo, WebserviceRequest request) throws Exception { Article article = (Article) JsonUtil.getObject(request.getPayload(), Article.class); Boolean saveStatus = ArticleHandler.getInstance().save(article); return JsonUtil.getJsonBasedOnDescriptor(saveStatus, Boolean.class); } </code></pre> <p>but when this object is reaching the save mthod in handler the richContent is changed to </p> <blockquote> <p>&amp;lt;p&amp;gt;this is the content that need to be stored in the database&amp;lt;/p&amp;gt;</p> </blockquote> <p>code for getObject method is as follows:</p> <pre><code>public static Object getObject(Object source, Class targetType) { try { return objMapper.convertValue(source, targetType); } catch (Exception ex) { throw new RuntimeException(ex); } } </code></pre> <p>but I need it in the same format as it was earlier so that i can perform few more operation on the same before saving it to db. Any help will be appreciated. Thank you in advance.</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload