I have the next problem, i have a page with view scope.
I have a datatable with rows as entity. Each entity has an image and if you want to edit, you can do it through p:dialog.
So i load the data of the entity with a commandButton (with actionListener) and open the dialog (with oncomplete) too:
Code: Select all
<p:commandLink id="btnImgNtrDlg" update=":dlgImgNtr"
actionListener="#{entrevistaBean
.getEntrevistaPk(obj.codEntrevista)}"
oncomplete="mostrarComponente('wdgImgNtr')">
<h:graphicImage value="#{msj.imgCamara}" styleClass="imgCentro"/>
</p:commandLink>
Code: Select all
<p:graphicImage id="ghLoadImg" cache="false"
styleClass="margin10 heigth70"
alt="#{entrevistaBean.auxNtr.problemaPrincipal}"
value="#{entrevistaBean.auxNtr.imagen}"
rendered="#{entrevistaBean
.isNtrImagen(entrevistaBean.auxNtr)}">
<f:viewParam name="paramId"
value="#{entrevistaBean.auxNtr.codEntrevista}" />
</p:graphicImage>
Code: Select all
public StreamedContent getImagen() {
FacesContext context;
context = FacesContext.getCurrentInstance();
// Devolvemos StreamedContent real con la imagen en bytes.
EntrevistaBean bean;
String paramId;
paramId = context.getExternalContext().getRequestParameterMap().get("paramId");
if (paramId != null) {
bean = entrevistaSrv.getEntrevistaId(Integer.valueOf(paramId));
return new DefaultStreamedContent(
new ByteArrayInputStream(bean.getImgEntrevista()));
} else {
return new DefaultStreamedContent(
new ByteArrayInputStream(this.getImgEntrevista()));
}
}
If I change the scope to session (and a few changes in backing bean) the image is displayed it but i want to get it with view scope, is it possible?
Help!