DetectionService ds = new DetectionService();
List<Detection> comboxList = ds.searchComboxList();
List<String> text = new ArrayList<String>();
List<String> value = new ArrayList<String>();
for(Detection d:comboxList){
text.add(d.getSource_idc());
value.add(d.getSource_ip());
}
JSONObject jsonObj = new JSONObject();
jsonObj.accumulate("name", text);
jsonObj.accumulate("ip", value);
String combox = JSONSerializer.toJSON(jsonObj).toString();
System.out.println(combox);
response.getWriter().write(combox);
response.getWriter().flush();
response.getWriter().close();
当前combox中的数据为: {"name":["xxxxx","xxxxx2"],"ip":["127.0.0.1","127.0.0.2"]} 在页面上如何通过textFiled和valueFiled进行设置填充? 我用的是jsp页面 |