Note that there are some explanatory texts on larger screens.

plurals
  1. POHow to show images in p:dataGrid using p:graphicImage
    primarykey
    data
    text
    <p>I have a p:dataGrid which shows companies . These companies have logo and I want to show their logo<br> in dataGrid under of their names but images don't appear in page . Only appears a broken image square . </p> <p>The xhtml code ;</p> <pre><code> &lt;p:dataGrid value="#{BDS_Company.companyList}" var="cmp" rows="5" columns="3"&gt; &lt;p:column&gt; &lt;h:panelGrid columns="1"&gt; &lt;h:outputLabel value="#{cmp.cmpName}"/&gt; &lt;h:outputLabel value="#{cmp.cmpEmail}"/&gt; &lt;p:graphicImage value="#{BDS_Company.companyLogo(cmp)}"/&gt; &lt;/h:panelGrid&gt; &lt;/p:column&gt; &lt;/p:dataGrid&gt; </code></pre> <p>The managed bean code ;</p> <pre><code>public DefaultStreamedContent companyLogo(BdsCompany company) { if (company != null) { if (company.getCmpLogo() != null) { InputStream is = new ByteArrayInputStream(company.getCmpLogo().getDocFile()); return new DefaultStreamedContent(is); } } return null; } </code></pre> <p>When I change code like that , I take an exception "Method companyLogo not found"</p> <pre><code>public DefaultStreamedContent getCompanyLogo(BdsCompany company) { if (company != null) { if (company.getCmpLogo() != null) { InputStream is = new ByteArrayInputStream(company.getCmpLogo().getDocFile()); return new DefaultStreamedContent(is); } } return null; } </code></pre> <p>But another page I used getPersonPicture() which shows loged person's profile picture and doesn't take parameter works great ! . I don't understand why companies' logos don't appear in page :/</p> <p>Can anyone help me about this situation or suggest another way to show images ?</p> <p>Thanks in advance .</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload