org.apache.commons.lang.StringEscapeUtils 这个类里面的 escapeHtml这个方法
具体用法
public static void escapeHtml(Writer writer,
String string)
throws IOException
Escapes the characters in a String using HTML entities and writes them to a Writer.
commons包可以在
http://commons.apache.org/lang/ 这里下载本回答被提问者采纳