最近感觉好累,不过总算把配置权限搞定了,期间出了好多各种各样的问题,特别是配置文件上,很容易就出问题了。
1.可以直接访问项目的一个方法,然后用PrintWriter 的方式显示:
// IO流输出JSON
public static void toOutputJSON(HttpServletResponse response,String json) {
PrintWriter out = null;
try {
out = response.getWriter();
logger.info("json :" + json);
} catch (IOException e) {
logger.error("JSON输出异常", e);
} finally {
out.write(json);
out.flush();
out.close();
}
}
json是你要返回的数据,JSON.toJsonString(待转换的数据,object)转成String
调用:finally {
toOutputJSON(response, json);
}
2.Maven的一些操作
加油!