json_data.jsp 2.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364
  1. <%@ page contentType="text/html; charset=UTF-8" language="java"%>
  2. <%@ page language="java" import="model.setup.constant.Collection" %>
  3. <%@ page language="java"
  4. import="com.sysmodel.datamodel.xmlmodel.ModelFactory,
  5. com.sysmodel.datamodel.xmlmodel.able.MdpConstant,
  6. com.sysmodel.datamodel.xmlmodel.able.Property,
  7. com.sysmodel.datamodel.xmlmodel.able.Template,
  8. com.sysmodel.datamodel.xmlmodel.DataContent,
  9. java.io.PrintWriter,
  10. java.util.*"%>
  11. <html>
  12. <head>
  13. <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
  14. <title>常量信息维护</title>
  15. </head>
  16. <body>
  17. <%
  18. String nodeID = request.getParameter("nodeID")==null?"":(String)request.getParameter("nodeID") ;
  19. String codeName =request.getParameter("codeName") == null ? "" : request.getParameter("codeName");
  20. Collection cs = new Collection(nodeID,codeName,request.getContextPath());
  21. MdpConstant constant = ModelFactory.getSysmodel().getMdpConstantByName(codeName);
  22. List array_elements = constant.getListDataContent();
  23. DataContent dataContent = null;
  24. Template template = constant.getTemplate();
  25. List listProperty = template.getListproperty();
  26. int icols = listProperty.size();
  27. PrintWriter pw = response.getWriter();
  28. String lineUrl = "";
  29. StringBuffer sb = new StringBuffer();
  30. sb.append("[");
  31. for (int i = 0; i < array_elements.size(); i++) {
  32. dataContent = (DataContent)array_elements.get(i);
  33. String tempNodeId = (String)dataContent.getValue("fd_code");
  34. lineUrl = "list.jsp?nodeID="+tempNodeId+"&codeName="+codeName;
  35. sb.append("{");
  36. for (int j = 0; j < icols; j++) {
  37. Property property = (Property)listProperty.get(j);
  38. String showName = "";
  39. Object obj = dataContent.getValue(property.getName());
  40. if(obj instanceof java.math.BigDecimal){
  41. showName = obj.toString();
  42. } else {
  43. showName = dataContent.getValue(property.getName()) == null ? "" : (String)dataContent.getValue(property.getName());
  44. }
  45. if(j != 0) sb.append(",");
  46. sb.append("\""+property.getName()+"\":\""+ showName +"\"");
  47. }
  48. sb.append(",\"edit\":\"<a href="+lineUrl+">修改</a>\"");
  49. sb.append(",\"delete\":\"<img src=../../../images/button/table_del.gif onClick=destroyMapButton('"+codeName+"','"+tempNodeId+"','delete');></img>\"");
  50. sb.append("}");
  51. if(i != array_elements.size() - 1) sb.append(",");
  52. }
  53. sb.append("]\n");
  54. response.setContentType("text/html;charset=utf-8");
  55. response.getWriter().write(sb.toString());
  56. response.getWriter().flush();
  57. response.getWriter().close();
  58. %>