java-byte[]图片在页面展示
public void img(HttpServletRequest req, HttpServletResponse res) { //res.setHeader("Content-Type", "image/jpeg"); //String reportType = req.getParameter("reportType"); String reportIdstr = req.getParameter("reportIdstr"); String pageIdstr = req.getParameter("pageIdstr"); String dataKey = req.getParameter("dataKey"); FbReportData data = null; try { data = this.fbReportDataService.findByReportIdAndPageIdAndDataKey(reportIdstr, pageIdstr, dataKey); } catch (Exception e) { e.printStackTrace(); } if(data!=null){ InputStream in = new ByteArrayInputStream(data.getData_value()); try { OutputStream out = res.getOutputStream(); byte[] b = new byte[in.available()]; in.read(b); out.write(b); out.flush(); in.close(); } catch (IOException e) { e.printStackTrace(); } } }
知识只有共享才能传播,才能推崇出新的知识,才能学到更多,这里写的每一篇文字/博客,基本都是从网上查询了一下资料然后记录下来,也有些是原滋原味搬了过来,也有时加了一些自己的想法