后台action处理使页面弹出提示框,且中文不出现乱码

2014-11-24 02:22:24 · 作者: · 浏览: 0

PrintWriter out=null;
try {
//设置回发内容编码
ServletActionContext.getResponse().setContentType("text/html;charset=utf-8");
out = ServletActionContext.getResponse().getWriter();
} catch (IOException e) {

e.printStackTrace();
}
out.print("<script>alert('请先删除下级数据!');history.go(-1);");
return null;

本文出自 “青春行囊” 博客