Code: Select all
<p:dataList value="#{searchMB.matching}" var="item"
paginator="true" rows="10" effectSpeed="fast"
paginatorTemplate="{PreviousPageLink} {CurrentPageReport} {NextPageLink} {RowsPerPageDropdown}"
rowsPerPageTemplate="10,25,50,100">
<p:graphicImage value="#{item.photo}"/>
${item.name}: ${item.gender} ${item.hairColor}
${item.country} ${item.majorLevel}
</p:dataList>
Code: Select all
public class SearchMB {
private List<DataListItem> data;
public List<DataListItem> getMatching() {
return data;
}
public class DataListItem {
private final CloserProfile profile;
private final StreamedContent photo;
private DataListItem(CloserProfile profile) {
this.profile = profile;
if (profile.getPhoto() == null) {
photo = null;
} else {
photo = new DefaultStreamedContent(
new ByteArrayInputStream(profile.getPhoto()), profile.getPhotoType());
}
}
public Object getPhoto() {
if(photo == null) {
return "/resources/no_photo.png";
}
return photo;
}
...
}
...
}