ajax 返回Json方法

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();
}
}
上一篇:MySQL master/slave 模式


下一篇:JavaPersistenceWithHibernate第二版笔记-第六章-Mapping inheritance-009Polymorphic collections(@OneToMany(mappedBy = "user")、@ManyToOne、)