当前位置 : 主页 > 编程语言 > java >

java 输出js 脚本

来源:互联网 收集:自由互联 发布时间:2021-06-28
gistfile1.txt 方法一 response.setHeader("Content-Type", "text/html; charset=UTF-8"); response.getWriter().write(""); response.getWriter().flush(); response.getWriter().close();方法二 response.setContentType("text/html;charset=UTF-8");
gistfile1.txt
方法一

        response.setHeader("Content-Type", "text/html; charset=UTF-8");
        response.getWriter().write("");
        response.getWriter().flush();
        response.getWriter().close();	



方法二

        response.setContentType("text/html;charset=UTF-8");
        response.setCharacterEncoding("UTF-8");
        response.setHeader("Cache-Control", "no-cache");
        PrintWriter out = response.getWriter();
        out.println("");
        out.flush();
        out.close();
        out = null;
        return null;




小技巧:
   
     java后台调用js代码
        response.setContentType("text/html");
        response.setCharacterEncoding("utf-8");
        String call_back = "";
        response.getWriter().write(call_back);
        response.getWriter().flush();
        response.getWriter().close();


     html前端调用函数(在同一个html中写两个script  后台调用不同的script函数 需要加上 parent.openStaticPopup)
    
   		
    
网友评论