Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我在 servlet 中有一个字节 [] 形式的图像。我想通过将请求转发到该 html(或 JSP)来将此图像发送到 html(或 JSP 页面)页面。请告诉我我将如何做到这一点,以及该图像将如何显示在 HTML 页面上。
我会将byte[]数据转换为图像,并为 HTML 页面提供生成图像的 URL。下面是一个简单的转换示例:
byte[]
BufferedImage img = ImageIO.read(new ByteArrayInputStream(bytes));
希望这可以帮助。