我有一个豆子
@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;
}
}
和graphicImage
<p:graphicImage value="#{profileBean.photo2}" library="images" width="110" height="150" id="photo" />
图片没有出现/ 我尝试过,就像建议here
一样但两个请求都是RENDER_RESPONSE ...
可能有替代方式,也许没有主要方面?