<%@ page import="net.sf.json.*"%> <%@ page pageEncoding="UTF-8"%> <%@ page import ="java.util.*"%> <%@ page language="java" import="com.sysmodel.datamodel.xmlmodel.ModelFactory, com.sysmodel.datamodel.xmlmodel.impl.MdpDataSourceImpl, com.sysmodel.datamodel.xmlmodel.able.SysModel"%> <% request.setCharacterEncoding("GB2312"); SysModel sysmodel = ModelFactory.getSysmodel(); ArrayList list = sysmodel.getMdpDataSources(); String callback=request.getParameter("callback"); try{ String json = callback+"({totalProperty:100,root:["; for (int i = 0; i < list.size(); i++) { MdpDataSourceImpl MdpDataSource = (MdpDataSourceImpl) list.get(i); Map map=new HashMap(); map.put("code",""+MdpDataSource.getDataSourceid()+""); map.put("Description", MdpDataSource.getDescription()); map.put("DataBase", MdpDataSource.getDataBase()); map.put("User", MdpDataSource.getUser()); map.put("Password", MdpDataSource.getPassword()); map.put("JNDI", MdpDataSource.getJNDI()); map.put("del","删除"); JSONObject jsonMap = JSONObject.fromObject(map); System.out.println(jsonMap); json += jsonMap.toString(); if (i != (list.size() - 1)) { json += ","; } } json += "]});"; System.out.println(); System.out.println(json); System.out.println(); response.getWriter().write(json); }catch(Exception e){ System.out.println("json----error!!!"); }%>