I send js variable to Spring controller by clicking button. That's what I have in js:
function submitArticle()
{
var pdata= $('textarea').froalaEditor('html.get');
$.post("/submitProject", pdata).done(function(response) {
console.log("Response: " + pdata);
});
}
So it works well, console.log displays next : <h1>New Article</h1><p>Some text</p>
but, that's what I get in Spring controller:
%3Ch1%3ENew+Article%3C%2Fh1%3E%3Cp%3ESome+text%3C%2Fp%3E=
It just replaces <
, >
, and
/
to some codes. How to replace them to normal tags. Because I want to store this html code in java String.
My Spring Controller:
@PostMapping("/submitProject")
public ModelAndView submitProject(@RequestBody String html, @ModelAttribute(value = "LoggedUser") User user)
{
System.out.println(html);
return new ModelAndView("redirect:/");
}