`

输出html

    博客分类:
  • Java
 
阅读更多
	/**
	 * 页面输出json
	 * @param json
	 */
	protected void writeJson(String json){
		response.setContentType("application/json;charset=UTF-8");
		response.setCharacterEncoding("UTF-8");
		response.setHeader("Cache-Control", "no-cache");// 清除缓存
		PrintWriter pw = null;
		try{			
			pw = response.getWriter();
			pw.write(json);
			pw.flush();
			pw.close();
		}catch (Exception e) {
		    log_.error("write 写json失败..."+e);
		    if(pw != null){
		        pw.close(); 
		    }
		}
	}

 

分享到:
评论

相关推荐

Global site tag (gtag.js) - Google Analytics