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();
}
}
相关文章
- ajax中设置contentType: “application/json”的作用
- ajax操作json的三种方式
- jquery Ajax请求示例,jquery Ajax基本请求方法示例
- jquery.ajax请求aspx和ashx的异同 Jquery Ajax调用aspx页面方法
- jQuery ajax 请求HttpServlet返回[HTTP/1.1 405 Method not allowed]
- jqgrid取所有行的值,jqgrid取行对应列(name)的值,jqgrid取多行值对应列转json的方法
- ajax循环读取json多维数组
- JQuery中$.ajax()方法参数详解 及 async属性说明
- 使用ajax获取JSON数据的jQuery代码的格式
- JQuery Ajax调用asp.net后台方法