how can i use graphicImage with ViewScoped Bean?

30 Views Asked by At

I have a bean

@ManagedBean
@ViewScoped
public class ProfileBean implements Serializable{
...

private StreamedContent photo2;

public ProfileBean() {

    InputStream iStream = FacesContext.getCurrentInstance().getExternalContext().getResourceAsStream("/resources/images/somePhoto.png");

    photo2 = new DefaultStreamedContent(iStream, "image/png");

    } 
public StreamedContent getPhoto2() {
    return photo2;
}

public void setPhoto2(StreamedContent photo2) {
    this.photo2 = photo2;
}

}

and graphicImage

<p:graphicImage value="#{profileBean.photo2}" library="images" width="110" height="150" id="photo" />

the picture not appears/ I tried, like advised here

but both requests are RENDER_RESPONSE...

may be there is alternative way, maybe without primefaces?

0

There are 0 best solutions below