The following used to work with p:graphicImage but not with o:graphicImage.
Problem: data_id is always null.
xhtml:
<p:dataScroller var="data"...
<p:graphicImage value="#{bean.imagel}" >
<f:param name="data_id" value="#{data._id}" />
</p:graphicImage>
Bean:
public InputStream getImage(){
String dataId = FacesContext.getCurrentInstance()
.getExternalContext()
.getRequestParameterMap()
.get("data_id");
I also tried with o:param with the same result. What am I missing?
The <f:param> inside <p:graphicImage> is a PrimeFaces-specific trick to get the StreamedContent thing to work "as expected".
The <o:graphicImage> doesn't support it (neither does standard <h:graphicImage>). Just pass it as EL method argument the usual way. It ends up in more clean code.
<o:graphicImage value="#{bean.getImage(data.id)}" />
public InputStream getImage(Long dataId) {
// ...
}
See also code examples in documentation.