listCols.jsp 2.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960
  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.MdpConstantImpl,
  8. com.sysmodel.datamodel.xmlmodel.able.SysModel"%>
  9. <% request.setCharacterEncoding("GBK");
  10. SysModel sysmodel = ModelFactory.getSysmodel();
  11. List list = null;
  12. String type=request.getParameter("type") == null ? "" : request.getParameter("type");
  13. if(type.equals("")){
  14. list = sysmodel.getMdpConstants();
  15. }else{
  16. list = sysmodel.getMdpConstantByType(type);
  17. }
  18. System.out.print("type = " + type);
  19. String begin=request.getParameter("start");
  20. String size=request.getParameter("limit");
  21. String callback=request.getParameter("callback");
  22. int index = Integer.parseInt(begin);
  23. int pageSize = Integer.parseInt(size);
  24. try{
  25. String json = callback+"({totalProperty:100,root:[";
  26. for (int i = 0; i < list.size(); i++) {
  27. MdpConstantImpl MdpConstant = (MdpConstantImpl) list.get(i);
  28. Map map=new HashMap();
  29. map.put("CodeName","<a href=\"edit.jsp?name="+MdpConstant.getCodeName()+"\">"+MdpConstant.getCodeName()+"</a>");
  30. map.put("Description",MdpConstant.getDescription());
  31. map.put("TemplateName",sysmodel.getTemplateByName(MdpConstant.getTemplateName()).getDescription());
  32. map.put("RootFrom",MdpConstant.getRootFrom());
  33. map.put("DataSource",sysmodel.getDataSourceByCode(MdpConstant.getDataSource()).getDescription());
  34. map.put("isKeyCodeAuto",MdpConstant.isKeyCodeAuto());
  35. map.put("OrderProperty",MdpConstant.getOrderProperty());
  36. map.put("OrderMethod",MdpConstant.getOrderMethod());
  37. map.put("ConstantName",sysmodel.getMdpModuleByCode(MdpConstant.getType()).getName());
  38. map.put("del","<a href=\"editExc.jsp?action=del&name="+MdpConstant.getCodeName() +"\">删除</a>");
  39. JSONObject jsonMap = JSONObject.fromObject(map);
  40. System.out.println(jsonMap);
  41. json += jsonMap.toString();
  42. if (i != (list.size() - 1)) {
  43. json += ",";
  44. }
  45. }
  46. json += "]});";
  47. //System.out.println();
  48. //System.out.println(json);
  49. //System.out.println();
  50. response.getWriter().write(json);
  51. }catch(Exception e){
  52. System.out.println("json----error!!!");
  53. }%>