Web常用方法
1.返回一个json格式报文
/**
* 返回json格式字符串或普通字符串
*
* @param jsonString
*/
protected void writeJson(String jsonString) {
HttpServletResponse response = ServletActionContext.getResponse();
try {
response.setContentType("text/html; charset=utf-8");
response.setCharacterEncoding("utf-8");
response.getWriter().write(jsonString);
} catch (IOException e) {
e.printStackTrace();
}
}