我使用streamedcontent呈现从JSF发送一个字节,然后发回的流媒体内容如下:graphicImage的在Primefaces
<p:graphicImage value="#{manage.bytesToStreamedContent(car.image)}"/>
其中图像是存储在图像的字节数组数据库
支持bean:
public StreamedContent bytesToStreamedContent(byte[] bytes)
{
InputStream is = new ByteArrayInputStream(bytes);
StreamedContent image = new DefaultStreamedContent (is, "image/jpeg");
return image;
}
但我没有得到在JSF页面图像。我得到这条消息出现在服务器日志中:
警告:JSF1091:文件dynamiccontent中找不到MIME类型。要解决此问题,请将mime-type映射添加到应用程序web.xml。
和:
SEVERE: Error in streaming dynamic resource.
可以请你帮我在这里,我不能找到有关这个问题的任何有用的信息
PS:
进出口使用以下库:
Mojarra 2.1.3
PrimeFaces 3.1.1
Glassfish 3.1
可能重复(http://stackoverflow.com/questions/10073905/problems-displaying-database-blob-image-in -primefaces-graphicimage) – BalusC 2013-06-27 11:49:57
相关/重复问题:http://stackoverflow.com/questions/8207325/display-image-from-database-with-pgraphicimage/,http://stackoverflow.com/questions/10073905/problems-显示数据库blob图像在primefaces-graphicimage,http://stackoverflow.com/questions/10944673/how-to-use-pgraphicimage-with-defaultstreamedcontent-in-an-uirepeat/,http:// stackoverflow .com/questions/8304967/how-to-use-pgraphicimage-with-streamedcontent-within-pdatatable/ – BalusC 2013-06-27 11:51:03
@BalusC但这篇文章比你提到的一些“相关”问题还要旧! – fareed 2013-06-27 16:35:59