//确保JSP和servlet的编码方式一致 resp.setContentType("text/html;charset=GBK"); List<String> jymdList = new ArrayList<String>(); PrintWriter out = null; try { //从数据库中取得List jymdList = efileViewUiService.getLymd(); //简单粗暴,对于Map这句也适用 String json = JSON.toJSONString(jymdList); //取得流向JSP传递数据 PrintWriter out = resp.getWriter(); out.print(json); } catch (BaseException e) { e.printStackTrace(); } finally{ out.close(); } 复制代码