【发布时间】:2018-02-05 23:04:58
【问题描述】:
我要做的基本上是在 jsp 页面上显示来自 Mysql 的图像。 我成功地使用以下代码将 blob 图像文件调用到我的 java servlet 中的输出流中。
在servlet中,
byte[] imgData = null;
Blob image1 = null;
image1 = result.getBlob("image1");
imgData = image1.getBytes(1, (int)image1.length());
在jsp中,
<%
response.setContentType("image/gif");
OutputStream o = response.getOutputStream();
o.write(imgData);
%>
这个方法的问题是这个jsp页面是用图片来实现的。 这样,页面会丢弃其他内容,只显示图像。 我想要做的是使用显示几张图片
<img src=??? width=??? height=???>
我尝试调整输出流图像的大小,但我认为没有办法。
请帮帮我
提前致谢。
【问题讨论】: