我有一颗豆子
@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;
}
}
和图形图像
<p:graphicImage value="#{profileBean.photo2}" library="images" width="110" height="150" id="photo" />
图片没有出现/我试过了,就像这里建议的那样
但两个请求都是 RENDER_RESPONSE ...
可能有其他方法,也许没有primefaces?