Java examples for Servlet JSP:Servlet
output Script from HttpServletResponse
import org.apache.log4j.Logger; import javax.servlet.http.HttpServletResponse; import java.io.IOException; import java.io.PrintWriter; import java.util.HashMap; import java.util.Set; public class Main{ public static void outScript(HttpServletResponse response, String json) { response.setHeader("Cache-Control", "no-cache"); response.setContentType("application/javascript;charset=UTF-8"); try {/*from w w w . j av a 2s .c o m*/ response.getWriter().write(json); response.getWriter().flush(); response.getWriter().close(); } catch (IOException e) { e.printStackTrace(); } } }