当前位置: 代码迷 >> Web前端 >> jquery操作地图
  详细解决方案

jquery操作地图

热度:81   发布时间:2012-10-06 17:34:01.0
jquery操作map

File类:

int?????? fileId;

String? filePath;

?

get、set方法略。。。

?

服务端FileManageAction.java:
Map map=new HashMap();
map.put("fileList", bizDao.getFileList());

String json=JSONArray.fromObject(map).toString();
log.info("json:"+json);

???
response.setHeader("Content-Type", "text/html; charset=GBK");
response.getWriter().write(json);

?

log.info打印结果:

[{"fileList":[{"fileId":2995,"filePath":"a.jsp"},
{"fileId":2990,"filePath":"b.jsp"},
{"fileId":2997,"filePath":"c.jsp"}]}]

?

页面:

var url="<%=request.getContextPath()%>/fileManage.do";

$.getJSON(url,
????function(data){
????????$.each(data[0],function(key,values){
??????? if(key=='fileList'){
????? ???$("#fileContent").append("<p>文件信息:</p>");
????? ???$(values).each(function(iex,item){
????? ????$("#fileContent").append("<p style='word-wrap:break-word'>文件路径:"+item.filePath+"</p><br>");
????? ???});
????? ???$("#fileContent").append("<hr>");
????? ??}

???????});
???}
??);

?

最终fileContent div展现:

文件信息:

文件路径:a.jsp

文件路径:b.jsp

文件路径:c.jsp

?

  相关解决方案