jQuery MiniUI

 找回密码
 立即注册
查看: 4528|回复: 1
打印 上一主题 下一主题

关于combox如何存放后台数据 [复制链接]

Rank: 2

跳转到指定楼层
楼主
发表于 2012-7-25 16:33:56 |显示全部楼层 |倒序浏览

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页面

Rank: 2

沙发
发表于 2012-7-26 11:21:38 |显示全部楼层
谢谢已经解决了。

Archiver|普加软件

GMT+8, 2024-5-18 23:10 , Processed in 1.067460 second(s), 11 queries .

Powered by Discuz! X2

© 2001-2011 Comsenz Inc.

回顶部