I have a simple form with a fileupload. the file upload and backing bean works perfect but i want to display uploaded images after upload. I've used ui:repeat but only the first image repeats for all uploads! I used multiple p:graphicImage instead of ui:repeat and result is absolutely correct. but i have to use ui:repeat or p:galleria.
here is ui:repeat usage with wrong result
<ui:repeat value="#{applicationImagesBean.screenidx}" var="idx">
<p:graphicImage value="#{applicationImagesBean.getScreen(idx)}" height="320"/>
</ui:repeat>
and here is multiple p:graphicImage which is correct but it's not what i want
<p:graphicImage value="#{applicationImagesBean.getScreen(0)}" height="320"/>
<p:graphicImage value="#{applicationImagesBean.getScreen(1)}" height="320"/>
<p:graphicImage value="#{applicationImagesBean.getScreen(2)}" height="320"/>
note that screenidx is a simple list contains 0,1,2,3, ... as integers
public StreamedContent getScreen(Integer idx) {
try {
File file = screenFiles.get(idx);
return new DefaultStreamedContent(new FileInputStream(file), null, "" + idx.intValue());
} catch (Exception e) {
e.printStackTrace();
}
return null;
}
in both samples I had a breakpoint on getSceen and idx has been sent correctly to getScreen but the result was different.
I tired a cache = false
and a timestamp
parameter but no result.