json

if(xnxqList!=null && xnxqList.size()>0){
String xnxq="";
for (int i = 0; i < xnxqList.size(); i++) {
Object[] object = (Object[]) xnxqList.get(i);
xnxq+="{\"xnxq\":\""+object[0].toString()+"\"},";
}
xnxq=xnxq.substring(0,xnxq.length()-1);
xnxq="["+xnxq+"]";
System.out.println(xnxq);
response.setCharacterEncoding("UTF-8");
response.setContentType("application/json; charset=utf-8");
PrintWriter out = null;
try {
out = response.getWriter();
out.write(xnxq);
} catch (IOException e) {
e.printStackTrace();
} finally {
if (out != null) {
out.close();
}
}

}

posted on 2017-04-06 17:27  知了不了了之  阅读(110)  评论(0编辑  收藏  举报