2 Replies Latest reply on Jul 5, 2010 4:31 AM by Sean Wu

    s:grahicImage in datatable bug?

    Sean Wu Newbie

      Hi all,
      I have a Person entity with a photo attribute with byte[] type and use seam-gen to generate ui (it uses seam application framework, entityhome and entityquery). In the personList.xhtml, I use s:graphicImage to show all the person's photos.

      <rich:dataTable id="personList"
                 rendered="#{not empty personList.resultList}">
                  <f:facet name="header">
                      <ui:include src="layout/sort.xhtml">
                          <ui:param name="entityList" value="#{personList}"/>
                          <ui:param name="propertyLabel" value="Id"/>
                          <ui:param name="propertyPath" value="person.id"/>
                  <h:outputText value="#{_person.id}"/>
                  <f:facet name="header">Photo</f:facet>
                  <s:graphicImage rendered = "#{_person.photo.size != null}"
                                  value = "#{_person.photo.data}">
                      <s:transformImageSize width="80" maintainRatio="true"/>
                  <h:outputText value="Not Available" rendered = "#{_person.photo.size == null}"/>

      The strange thing appears when I edit/upload a photo for a person. For example, I upload a image for person whose id is 3. When I visit personList.xhtml, I find the photo column of persons with id '1' and '2' show Not Available which I expect. But the photo column ofpersons with id larger than 3 show the same image I upload for person whose id is 3!!! And follows the Not Available Text!!
      I am sure the photo of the persons whose id is larger than 3 is empty or null after I checked the database. And I also print their size in the page and shows zero that I expect. I do think this is due to the seam cause I checked the page source and found


      But I just upload one photo for a person with id is 3!! There must be something wrong with the imagestore. Can somebody help?
      Or can somebody show a demo about how to show images in a datatable?
      Thanks in advance.