Answers for "htmlspecialchars for jsp"

0

htmlspecialchars for jsp

StringBuffer sb = new StringBuffer();

for(int i=0; i<content.length(); i++){

char c = content.charAt(i);

  switch (c) {

    case '<' : 

      sb.append("&lt;");

      break;

    case '>' : 

      sb.append("&gt;");

      break;

    case '&' :

      sb.append("&amp;");

      break;

    case '"' :

      sb.append("&quot;");

      break;

    case '\'' :

      sb.append("&apos;");

      break;

    default:

      sb.append(c);

	}

}
Posted by: Guest on April-09-2021

Code answers related to "Javascript"

Browse Popular Code Answers by Language