做的一个项目,有一个展示信息的页面,同时要展示相应的图片。
一开始是想用jQuery easyUI的datagrid,但是这个显示效果不好,会出现表格的一些特性,展示图片时会有加减号控制。其实是我想多了,图片就放在本地,数据库表中只是存储的图片的基本信息(ID,URL等),其实可以在后台获取这些信息后直接传到页面,在相应的地方展示出来就可以了。在这我是在一个form表单中展示。
后台controller
@ResponseBody @RequestMapping("/apply/veriApplyGet") public String getVeriApply(String id, String techCls){ String sql = ""; if("1".equals(techCls)){ sql = "select p.id, p.data_id, p.pics_url, p.pics_name from TBL_BASE_PICS p,TBL_TECH_ACHV a where p.data_id = a.id and a.id = '"+id+"' and p.data_cls = '1' "; } if("2".equals(techCls)){ sql = "select p.id, p.data_id, p.pics_url, p.pics_name from TBL_BASE_PICS p,TBL_TECH_DEMAND d where p.data_id = d.id and d.id = '"+id+"' and p.data_cls = '2' "; } List photoList = commonService.execSql4List(sql, true, true); Map<String, Object> infoMap = this.getVeriEntityInfo("get", Integer.parseInt(techCls), id); infoMap.put("photo", photoList); return this.writeJson(infoMap); } |
前台展示
.ftl <div data-options="region:'east',width:360" style="padding:10px 5px;"> <form id="photoForm1" method="post"></form></div> script //处理图片表photoForm |