Tag: graphicimage

如何在ui:repeat中使用DefaultStreamedContent的<p:graphicImage>?

我试图显示一个面板,用户可以看到一个项目类别列表(显示为图像),并点击他们可以查看类别内的产品(图像将显示) 为了显示项目类别,我使用了ui:repeat nad the supporting bean calss下面是我的xhtml代码 <ui:repeat id="repeat" value="#{getData.images}" var="img" varStatus="loop"> <h:panelGroup> <p:graphicImage id="img1" value="#{img}" alt="image not available" > </p:graphicImage> </h:panelGroup> </ui:repeat> 还有Managed Bean Code部分 private ByteArrayOutputStream baos = new ByteArrayOutputStream(); private List<StreamedContent> imageList = new ArrayList<StreamedContent>(); public List<StreamedContent> getImages(){ for (int i = 0; i < sdh.getNumOfImages(); i++) { imageID = imageIDArray.get(i); ImageService […]

在<ui:repeat>中的<p:graphicImage>中显示数据库blob图像

我在JBoss 7.1.1上使用PrimeFaces 3.2。 我试图在<ui:repeat>中的MySQL数据库中显示存储在BLOB中的图像。 图像存储在一个byte[] ,然后转换为一个StreamedContent ,如下所示: InputStream stream = new ByteArrayInputStream(ingredient.getImage()); ingredient.setJsfImage(new DefaultStreamedContent(stream, "image/jpg")); 然后我试图在Facelet中显示它,如下所示: <ui:repeat var="ingredient" value="#{formBean.ingredientResultSet}"> <p:panel id="resultsPanel" header="#{ingredient.location.shopName}"> <p:graphicImage value="#{ingredient.jsfImage}" alt="No picture set" /> … 但是,当加载页面时,我在JBoss中出现以下错误: SEVERE [org.primefaces.application.PrimeResourceHandler](http – 127.0.0.1-8080-12)streamdynamic资源错误。 这是如何造成的,我该如何解决?

使用<h:graphicImage>或<img>标签从webapps / webcontext / deploy文件夹外部加载图像

我需要使用JSF <h:graphicimage>标记或HTML <img>标记显示驻留在Web应用程序的deploy文件夹之外的图像。 我怎样才能做到这一点?