springmvc 后台实体类接受前端json字符串时,其中一个属性content 接受富文本内容时 标签<p>、<span> 这些标签丢失问题解决

问题描述:

前端一个字段

<script id="editor" type="text/plain" name="content" style="width:600px;height:400px;border-radius: 3px;" >$content!}</script>
向后台传该富文本值是 前端控制台打印内容如下
<p>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span style="color: rgb(151, 72, 6);"> &nbsp;<span style="color: rgb(151, 72, 6); font-size: 20px;">大师傅的阿萨德</span></span></p>
属于完整的带有标签的内容
但是后台使用实体类接受时候 实体类属性content 只有
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;大师傅的阿萨德
所有的标签丢失
不会报错,找了一整天问题所在,也怀疑了狠狠多多地方,结果都不是
究其问题所在:前端form表的缺少 enctype="multipart/form-data" 编码属性



posted @ 2019-09-17 19:44  blue天空  阅读(2372)  评论(0编辑  收藏  举报