CopyCodeThe Code is as follows :/**
* HTML code input verification Conversion
* @ Param Str
* @ Return
*/
Public String htmlfilter (string Str ){
// Conversion &
STR = Str. replaceall ("&","&");
// Conversion <
STR = Str. replaceall ("<", "<");
// Conversion>
STR = Str. replaceall (">", "> ");
// Converted to a space,
// Note: using "" with spaces will cause XML parsing errors !, Only "" can be used here ""
STR = Str. replaceall ("","");
// Quote single quotes
STR = Str. replaceall ("'","'");
// Double quotation marks
STR = Str. replaceall ("\"",""");
// Transpose line feed
STR = Str. replaceall ("\ n", "<br> ");
Return STR;
}
// This method is used to change the meaning of the XML code generated by the servlet, mainly to convert <br> to normal display.
Public String htmlfilter2 (string Str ){
// Conversion <
STR = Str. replaceall ("<", "<");
// Conversion>
STR = Str. replaceall (">", "> ");
Return STR;
}