html页面特殊符号转义还原

参考:
1.java后台对前端输入的特殊字符进行转义

StringEscapeUtils.unescapeHtml4(zzRewards.getRwTimeCon())

1
2
3
4
5
6
7
8
9
10
11
12
/**
24 * apache的StringEscapeUtils进行转义
25 */
26 //<a href='http://www.qq.com'>QQ</a><script>
27 System.out.println(org.apache.commons.lang.StringEscapeUtils.escapeHtml(str));
28
29 /**
30 * apache的StringEscapeUtils进行还原
31 */
32 //<a href='http://www.qq.com'>QQ</a><script>
33 System.out.println(org.apache.commons.lang.StringEscapeUtils.unescapeHtml("<a href='http://www.qq.com'>QQ</a><script>"));
34 }