<img id="bac100" width="110px" height="140px"
src="${rootPath}/insurcardheavycard/ShowPersonPhotoAction.action?aac001=${checkedFailePersonDTO.id}">
这个是jsp页面显示的一个例子,可以显示多张图片。其中src= "${rootPath}/insurcardheavycard/ShowPersonPhotoAction.action?aac001=${checkedFailePersonDTO.id}" 指向action,传入参数checkedFailePersonDTO.id唯一标识出是哪一张图片
后台获取到对应的流后:可以通过下面方法输出到输出流中
private void outputPicture(HttpServletResponse res, InputStream inputStream)
throws IOException {
if (inputStream == null) {
return;
}
OutputStream out = res.getOutputStream();
byte[] buff = new byte[1024];
int length = 0;
while ((length = inputStream.read(buff)) > 0) {
out.write(buff, 0, length);
}
out.flush();
out.close();
}
src="${rootPath}/insurcardheavycard/ShowPersonPhotoAction.action?aac001=${checkedFailePersonDTO.id}">
这个是jsp页面显示的一个例子,可以显示多张图片。其中src= "${rootPath}/insurcardheavycard/ShowPersonPhotoAction.action?aac001=${checkedFailePersonDTO.id}" 指向action,传入参数checkedFailePersonDTO.id唯一标识出是哪一张图片
后台获取到对应的流后:可以通过下面方法输出到输出流中
private void outputPicture(HttpServletResponse res, InputStream inputStream)
throws IOException {
if (inputStream == null) {
return;
}
OutputStream out = res.getOutputStream();
byte[] buff = new byte[1024];
int length = 0;
while ((length = inputStream.read(buff)) > 0) {
out.write(buff, 0, length);
}
out.flush();
out.close();
}
本文介绍了一种在JSP页面上展示用户照片的方法,并详细解释了如何通过后台Action接收参数并返回相应的图片流。此外,还提供了一个将图片流输出到客户端的具体实现。
6153

被折叠的 条评论
为什么被折叠?



