JSP
JSP htmlspecialchars
엘로드넷
2015. 4. 18. 08:21
JSP htmlspecialchars
StringBuffer sb = new StringBuffer();
for(int i=0; i<content.length(); i++){
char c = content.charAt(i);
switch (c) {
case '<' :
sb.append("<");
break;
case '>' :
sb.append(">");
break;
case '&' :
sb.append("&");
break;
case '"' :
sb.append(""");
break;
case '\'' :
sb.append("'");
break;
default:
sb.append(c);
}
}