<%! public static String filter(String input) { StringBuffer filtered = new StringBuffer(input.length()); char c; for(int i=0; i<input.length(); i++) { c = input.charAt(i); if (c == '<') { filtered.append("<"); } else if (c == '>') { filtered.append(">"); } else if (c == '"') { filtered.append("""); } else if (c == '\'') { filtered.append("´"); } else if (c == '&') { filtered.append("&"); } else { filtered.append(c); } } return(filtered.toString()); } %>
本文地址:http://com.8s8s.com/it/it17079.htm