SSM+EasyUI之数据表格中图片展示,供新手参考!

数据库图片字段保存图片名字即可,如:zhangsan.jpg 

1、model层

private String simage;
//此处省略其他字段
public String getSimage() {
        return simage;
    }

    public void setSimage(String simage) {
        this.simage = simage;
    }

2、dao层

List find(Map map);

3、service层

List find(Map map);

4、serviceImpl层

@Service("StudentService")
public class StudentServiceImpl implements StudentService {

    @Autowired
    private StudentDao studentDao;
@Override
    public List find(Map map) {
        return studentDao.find(map);
    }

 5、mapper


    
        
        

 

6、controller

@RequestMapping("/list")
    public String list(HttpServletResponse res) throws Exception {
        List studentList = studentService.find(map);
        JSONObject result = new JSONObject();
        JSONArray jsonArray = JSONArray.fromObject(studentList);
        result.put("rows", jsonArray);
        ResponseUtil.write(res, result);
        return null;
        }
    

 7、json数据工具

public class ResponseUtil {
    public static void write(HttpServletResponse response, Object object) throws Exception {
        response.setContentType("text/html;charset=utf-8");
        PrintWriter out = response.getWriter();
        out.println(object);
        out.flush();
        out.close();
    }
}

6、数据表格


        //此处省略其他字段
        
图像采集信息

7、图片展示js代码 

function showImg(val,row){
            return '';
        }

8、效果展示

SSM+EasyUI之数据表格中图片展示,供新手参考!_第1张图片

你可能感兴趣的:(SSM+EasyUI之数据表格中图片展示,供新手参考!)