import javax.servlet.ServletOutputStream;
import javax.servlet.http.HttpServletResponse;
public class CommonUtil {
public static void setResponseMessage(HttpServletResponse response, String msg) {
setResponseHtmlMessageScript(response, null, msg, null);
}
public static void setResponseScript(HttpServletResponse response, String script) {
setResponseHtmlMessageScript(response, null, null, script);
}
public static void setResponseMessageScript(HttpServletResponse response, String msg, String script) {
setResponseHtmlMessageScript(response, null, msg, script);
}
public static void setResponseHtmlMessageScript(HttpServletResponse response, String html, String msg, String script) {
response.setContentType("text/html; charset=UTF-8");
response.setHeader("Content-Type", "text/html; charset=utf-8");
try {
ServletOutputStream out = response.getOutputStream();
out.print("");
if ( html != null && !"".equals(html.trim())) {
out.print(new String(html.getBytes("utf-8"), "ISO_8859_1"));
}
out.print("");
out.print("");
out.flush();
} catch ( Exception e ) {
System.out.println(e);
}
}
}