Spring HtmlUtils把HTML编码转义,可将HTML标签互相转义

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); 


猜你喜欢

转载自blog.csdn.net/whg841001/article/details/54800042