SpringBoot入门到精通-springboot 富文本字段返回结果 respone html标签丢失了

基于Springboot controller开发时富文本存储到库中,但接口查询返回时结果中html的标签都被过滤掉了;

查询源码跟踪也找不出有特殊的设置;
在这里插入图片描述
脑回路猛转

String s = HtmlUtils.htmlEscape("<div>hello world</div><p>&nbsp;</p>");  

System.out.println(s);  

&lt;div&gt;hello world&lt;/div&gt;&lt;p&gt;&amp;nbsp;&lt;/p&gt; 

String s2 = HtmlUtils.htmlUnescape(s);
System.out.println(s2);

在这里插入图片描述
参考链接:https://blog.csdn.net/wxb880114/article/details/107401897

猜你喜欢

转载自blog.csdn.net/qq_25983579/article/details/113750003