How to display an image in jsp?

前端 未结 2 1119
悲&欢浪女
悲&欢浪女 2020-11-30 12:05

I have a bytearray image.

I need to show that image in jpg format in jsp page and while clicking the image, i can download the image to my pc:

I am loading

2条回答
  •  余生分开走
    2020-11-30 12:36

    JSP:

    " width="117" height="160" onError="loadImage()" onAbort="loadImage()" />

    Servlet //imageDisplayProcess

    imgByt = imageClass.getPhotograph();//return blob...
    response.setContentType("image/jpg");
    response.getOutputStream().write(imgByt);
    response.getOutputStream().flush();
    response.getOutputStream().close();
    

提交回复
热议问题