I'm having this problem and I don't know why is this happening, I tried so many things but... no success, thanks for your help.
this is the problem:
GRAVE: Servlet.service() para servlet [Faces Servlet] lanzó excepción java.io.IOException: javax.el.PropertyNotFoundException: /catalogoAdmin.xhtml @16,40 value="#{catalogoBean.image}": Propiedad [image] no hallada en el tipo [beans.CatalogoBean] at org.primefaces.component.graphicimage.GraphicImageRenderer.encodeEnd(GraphicImageRenderer.java:43) at javax.faces.component.UIComponentBase.encodeEnd(UIComponentBase.java:919) at javax.faces.component.UIComponent.encodeAll(UIComponent.java:1863) at javax.faces.render.Renderer.encodeChildren(Renderer.java:176) at javax.faces.component.UIComponentBase.encodeChildren(UIComponentBase.java:889) at javax.faces.component.UIComponent.encodeAll(UIComponent.java:1856) at javax.faces.component.UIComponent.encodeAll(UIComponent.java:1859) at javax.faces.component.UIComponent.encodeAll(UIComponent.java:1859) at com.sun.faces.application.view.FaceletViewHandlingStrategy.renderView(FaceletViewHandlingStrategy.java:456) at com.sun.faces.application.view.MultiViewHandler.renderView(MultiViewHandler.java:133) at com.sun.faces.lifecycle.RenderResponsePhase.execute(RenderResponsePhase.java:120) at com.sun.faces.lifecycle.Phase.doPhase(Phase.java:101) at com.sun.faces.lifecycle.LifecycleImpl.render(LifecycleImpl.java:219) at javax.faces.webapp.FacesServlet.service(FacesServlet.java:647)
and this is my code:
Method Bean
public StreamedContent getImage() throws IOException {
FacesContext context = FacesContext.getCurrentInstance();
if (context.getCurrentPhaseId() == PhaseId.RENDER_RESPONSE) {
return new DefaultStreamedContent();
} else {
String filename = context.getExternalContext().getRequestParameterMap().get("nombre");
return new DefaultStreamedContent(new FileInputStream(new File("C:\\images/", filename)));
}
}
xhtml
<h:form id="formImg">
<p:graphicImage value="#{catalogoBean.image}"
style="height:150px; width:150px;">
<f:param name="nombre" value="ram.png" />
</p:graphicImage>
</h:form>