org.springframework.web.util.HtmlUtils 可以实现HTML标签及转义字符之间的转换。
/** HTML转义 **/
String s = HtmlUtils.htmlEscape("<div>hello world</div><p> </p>");
System.out.println(s);
String s2 = HtmlUtils.htmlUnescape(s);
System.out.println(s2);
org.springframework.web.util.HtmlUtils 可以实现HTML标签及转义字符之间的转换。
/** HTML转义 **/
String s = HtmlUtils.htmlEscape("<div>hello world</div><p> </p>");
System.out.println(s);
String s2 = HtmlUtils.htmlUnescape(s);
System.out.println(s2);