listCols.jsp 1.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. <%@ page import="net.sf.json.*"%>
  2. <%@ page pageEncoding="UTF-8"%>
  3. <%@ page
  4. import ="java.util.*"%>
  5. <%@ page language="java"
  6. import="com.sysmodel.datamodel.xmlmodel.ModelFactory,
  7. com.sysmodel.datamodel.xmlmodel.impl.MdpDataSourceImpl,
  8. com.sysmodel.datamodel.xmlmodel.able.SysModel"%>
  9. <% request.setCharacterEncoding("GB2312");
  10. SysModel sysmodel = ModelFactory.getSysmodel();
  11. ArrayList list = sysmodel.getMdpDataSources();
  12. String callback=request.getParameter("callback");
  13. try{
  14. String json = callback+"({totalProperty:100,root:[";
  15. for (int i = 0; i < list.size(); i++) {
  16. MdpDataSourceImpl MdpDataSource = (MdpDataSourceImpl) list.get(i);
  17. Map map=new HashMap();
  18. map.put("code","<a href=\"edit.jsp?dataSourceid="+MdpDataSource.getDataSourceid()+"\">"+MdpDataSource.getDataSourceid()+"</a>");
  19. map.put("Description", MdpDataSource.getDescription());
  20. map.put("DataBase", MdpDataSource.getDataBase());
  21. map.put("User", MdpDataSource.getUser());
  22. map.put("Password", MdpDataSource.getPassword());
  23. map.put("JNDI", MdpDataSource.getJNDI());
  24. map.put("del","<a href=\"editExc.jsp?action=del&dataSourceid="+MdpDataSource.getDataSourceid()+"\">删除</a>");
  25. JSONObject jsonMap = JSONObject.fromObject(map);
  26. System.out.println(jsonMap);
  27. json += jsonMap.toString();
  28. if (i != (list.size() - 1)) {
  29. json += ",";
  30. }
  31. }
  32. json += "]});";
  33. System.out.println();
  34. System.out.println(json);
  35. System.out.println();
  36. response.getWriter().write(json);
  37. }catch(Exception e){
  38. System.out.println("json----error!!!");
  39. }%>