更新时间:2023-12-03 23:40:58
您需要将图像作为字节数组写入响应的输出流。这样的事情:
You need write the image as a byte array to the response's output stream. Something like this:
byte [] imageBytes = getImageAsBytes();
响应。 setContentType(image / jpeg);
response.setContentLength(imageBytes.length);
response.getOutputStream()。write(imageBytes);
然后在JSP中你只需使用一个标准的img元素:
Then in you JSP you just use a standard img element:
<img src="url to your servlet">