I have a Bean which has a List of Objects, containing StreamedContent Objects (Primefaces Type) which represent Images in a Database. Now I want to iterate over this list in
I broke my head on this one for a day or so, but I found a solution!
JSF:
Managed bean:
public List getImages(){
List l = new ArrayList();
for(Theme t:themeFacade.findAll())
l.add(t.getId().toString());
return l;
}
public StreamedContent getImage(){
FacesContext context = FacesContext.getCurrentInstance();
HttpServletRequest myRequest = (HttpServletRequest) context.getExternalContext().getRequest();
String imageID = (String) myRequest.getParameter("imageID");
return new DefaultStreamedContent(new ByteArrayInputStream(themeFacade.find(Long.parseLong(imageID)).getImage()));
}