//bean file
package loveJSP;
public class encodeHtml
{
private String html="no input Html";
public String getHtml()
{
return HTMLEncode(Html);
}
public void setHtml(String Html)
{
this.html = Html ;
}
private static String HtmlEncode(String text)
{
if (text==null)
return "";
StringBuffer results = null;
char[] orig = null;
int beg = 0,len=text.length();
for (int i=0;i
beg)
results.append(orig,beg,i-beg);
beg = i + 1;
switch (c)
{
default : continue;
case "&": results.append("&"); break;
case "<": results.append("<"); break;
case ">": results.append(">"); break;
case """: results.append("""); break;
}
break;
} //switch
}// for i
if (results == null)
return text;
results.append(orig,beg,len-beg);
return results.toString();
}// HtmlEncode
}