public static void sendJsonData(String data) { ActionContext ac = ActionContext.getContext(); HttpServletResponse response = (HttpServletResponse)ac.get("com.opensymphony.xwork2.dispatcher.HttpServletResponse"); response.setContentType("text/html;charset=utf-8"); try { PrintWriter pw = response.getWriter(); pw.print(data); } catch (IOException e) { e.printStackTrace(); } }