public void queryDataById(WebContext context) {
HttpServletRequest request = WebcUtils.getRequest(context);
HttpServletResponse response = WebcUtils.getResponse(context);
try {
PrintWriter out = response.getWriter();
String id = request.getParameter("id");
Map<String, Object> map = demoBizc.queryForId(id);
String rs = "{}";
if (map != null && map.size() > 0) {
rs = JSONObject.fromObject(map).toString();
}
out.write(rs);
out.flush();
} catch (Exception e) {
e.printStackTrace();
}
}
为什么可以得到map的值,但是将map的值传给rs时就显示 rs还是等于{}呢?
------解决思路----------------------
JSONArray.fromObject(map)呢
------解决思路----------------------
或者断点调试一下
------解决思路----------------------
不大可能吧应该....
map的key和value都有值吗...
syso出来看下