jsp
1 <IMG width="200" height="200" border="0" style="cursor: pointer;"
2 src="<%=request.getContextPath()%>/xxxx.do?type=show&pkId=xx">
action.do
1 if(type.equals("show"))
2 {
3 InputStream inputsteam = null;
4 Long pkId=Long.parseLong(servletRequest.getParameter("pkId"));
5 if (pkId != null&&!pkId.equals(""))
6 {
7 inputsteam = bpo.getBlobByID(pkId).getBinaryStream();
8
9
10 BufferedImage image = ImageIO.read(inputsteam);
11 ServletOutputStream sos = servletResponse.getOutputStream();
12 JPEGImageEncoder encoder = JPEGCodec.createJPEGEncoder(sos);
13 encoder.encode(image);
14 inputsteam.close();
15
16 }
17 return null;
18 }
19
posted on 2007-05-05 23:20
NG 阅读(486)
评论(0) 编辑 收藏