Springmvc 怎么从controller传图片给JSP显示

controller中的代码:
BufferedImage img1 = null;
BufferedImage img2 = null;
if(student.getId_card_scan()!= null | student.getDiploma_scan() != null)
{
ByteArrayInputStream in1 = new ByteArrayInputStream(student.getId_card_scan());
img1 = ImageIO.read(in1);
ByteArrayInputStream in2 = new ByteArrayInputStream(student.getDiploma_scan());
img2 = ImageIO.read(in2);
in1.close();
in2.close();
}
model.addAttribute("id_card_scan",img1);
model.addAttribute("diploma_scan",img2);

在JSP中要怎样才能把图片显示出来

第1个回答  2014-05-05
干嘛整的这么麻烦,把图片生成代码放到对应的jsp中,controller只是负责跳到jsp
第2个回答  2014-11-03
楼主,请问你这问题解决了吗?现在我也遇到了这样的问题!
相似回答