日期:2014-05-17  浏览次数:20725 次

JSP页面图片能显示出来,但是页面别的信息为空白
<td class="tdright" style="padding-right: 4px;">凭证图片</td>
<td class="tdright">
<%
byte[] a = ((MdeliveryOrder)request.getAttribute("morder")).getVoucherImg();
response.setContentType("image/gif");
OutputStream o = response.getOutputStream();
o.write(a);
o.flush();
o.close();
%>
</td>

------解决方案--------------------
重新理解了下你的逻辑思路后,终于大概知道你问题在哪了。

楼主你混淆了HTML页面和图片吧?

企图把HTML页面和图片一起输出是做不到的。

出库单页面中,只能是类似这样:
<td class="tdright" style="padding-right: 4px;">凭证图片</td>
<td class="tdright">
<img src="image.jsp?imageId=xxxooo" />
</td>


然后另外写个image.jsp
<%
byte[] a = ((MdeliveryOrder)request.getAttribute("morder")).getVoucherImg();
response.setContentType("image/gif");
OutputStream o = response.getOutputStream();
o.write(a);
o.flush();
%>

------解决方案--------------------
<img width="???" height="???" src="image.jsp?imageId=xxxooo" />