[英]Display image from response
我已经将图像写入httpresponse
,为图像定义了contentType
。
response.getOutputStream().write(imageBytes);
response.getOutputStream().flush();
在jsp中显示此图像的语法是什么?
您可以为此使用base64
编码。 为此,您需要在服务器端将其编码为base64,并在客户端将其嵌入为-
<img src="data:png;base64,base64_encoded_image_here">
当然,可以用适当的mime_type替换png。 缺点是图像将成为HTML内容的一部分。 但是此图像不会有单独的HTTP请求。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.