将导入的文件生成数据字典

今天的工作是将导入的文件生成数据字典;

导入的文件:

public void Ttable( HttpServletRequest request,HttpServletResponse response) throws ServletException, IOException, SQLException {
request.setCharacterEncoding("utf-8");
response.setContentType("text/html;charset=UTF-8");
System.out.println("连接了生成表格");
/*
PrintWriter out = response.getWriter();
String json="{'code': 0,'msg':'','count':100,'data':[{'id':'1','username':'name','sex':'男'}]}";
return json;

*/
List<SqlTableBean> list=dao.getTableAll("firtable");
JSONArray json=new JSONArray();
for(int i=0;i<list.size();i++){
JSONObject ob=new JSONObject();
ob.put("ywname",list.get(i).getYwname());
ob.put("zwname",list.get(i).getZwname());
ob.put("danwei",list.get(i).getDanwei());
ob.put("zdtype",list.get(i).getZdtype());
ob.put("beizhu",list.get(i).getBeizhu());
ob.put("ispri",list.get(i).getIspri());
ob.put("chtime",list.get(i).getChtime());
json.add(ob);
}
JSONObject ob=new JSONObject();
ob.put("code", 0);
ob.put("msg", "");
ob.put("count",1);
ob.put("data",json);
PrintWriter out = response.getWriter();
out.write(ob.toString());
}
这样就可以将导入的文件生成数据字典了
原文地址:https://www.cnblogs.com/092e/p/15526146.html