servlet提交后弹出提示框并页面跳转

    PrintWriter out = response.getWriter();
    out.print("<script>alert('数据添加成功');location.href='/JFreeChartTest/upload_file.jsp'</script>");

如果前台弹出的提示框中显示的是????,需添加response.setContentType( "text/html;charset=GBK ");

即:     response.setContentType( "text/html;charset=GBK ");
            PrintWriter out = response.getWriter();
            out.print("<script>alert('数据添加成功');location.href='/JFreeChartTest/upload_file.jsp'</script>");

posted @ 2012-09-12 15:55  の对的  阅读(2211)  评论(0编辑  收藏  举报