I have the following datatable:
<p:dataTable id="persons" styleClass="hide-column-names personTable"
value="#{personListDisplayerBean.allPersonsModel}" var="person"
paginator="true" rows="25"
paginatorTemplate="{CurrentPageReport} {FirstPageLink} {PreviousPageLink} {PageLinks} {NextPageLink} {LastPageLink} {RowsPerPageDropdown}"
rowsPerPageTemplate="5,10,25,50,100"
selection="#{personDetailsDisplayerBean.selectedPerson}"
filteredValue="#{personListDisplayerBean.filteredPersons}"
selectionMode="single" widgetVar="personTable">
...
...
<p:column styleClass="person-list-image-column">
<p:graphicImage styleClass="thumbnail"
value="#{personListDisplayerBean.getImageForPerson(person)}" />
</p:column>
...
...
</p:dataTable>
(Made it a little shorter)
Now to my problem: The Method getImageForPerson
is invoked twice. The reason why is explained in this post here:
Display dynamic image from database with p:graphicImage and StreamedContent
The first time invoking everything is fine, but the second time it is invoke i only receive a null as Parameter...
The method itself looks something like this:
String fileName = person.getObjectGUID();
File f = new File(fileName + ".jpg");
FileInputStream inputStream;
try {
inputStream = new FileInputStream(f);
} catch (FileNotFoundException e) {
return new DefaultStreamedContent();
}
stream = new DefaultStreamedContent(inputStream,"image/jpg");
return stream;
Why does JSF give me a null as parameter the second time the Method is invoked? Can i overcome this problem somehow?
Thanks in advance :)