1

I am trying to show image for each row in my data table. I took an example from omnifaces:

    <!-- Table with role list -->
<p:dataTable id="idRolesTable" value="#{staffMB.roleNestedList}"  var="row"
    paginatorAlwaysVisible="false" paginator="#{userSessionMB.getWebOption('paginator')}" 
    paginatorTemplate="#{userSessionMB.paginatorTemplate}" selection="#{staffMB.selectedRole}" selectionMode="single"
    paginatorPosition="#{userSessionMB.getWebOption('paginatorPosition')}" rowsPerPageTemplate="10,15,20,50"
    rows="10" emptyMessage="#{contentMB.msg.label_noItemsFound.value}" rowKey="#{row.pid}" widgetVar="roleTable"  
    tableStyle="table-layout: fixed;" filteredValue="#{staffMB.filteredRoleList}">


    <!-- Image -->
    <p:column id="slRoleImageColumn" headerText="#{contentMB.msg.label_id.value}" sortBy="#{row.roleId}" style="width:5%;"
        filterBy="#{row}" filterFunction="#{staffControllerMB.filterByRoleId}">
        <o:graphicImage value="#{imagesMB.getImage(row.ownerPerson.documentId)}" width="50"/>
    </p:column>

with ImageMB class:

@ManagedBean(name = "imagesMB")
@ApplicationScoped
public class ImagesMB extends BaseControllerMB {

private static final long serialVersionUID = 7074295738016877803L;

@ManagedProperty(value = "#{documentManager}")
protected IDocumentManager documentManager = null;


public byte[] getImage(Integer docId) {
    PpbDocsDbBean image = documentManager.getDefaultDocument(docId);

    if (image == null)
        return null;

    Integer size = image.getPptDfiles().getDoclen();
    byte[] byteArrayDocument = image.getPptDfiles().getDocstore().getFixedByteArray(size);
    return byteArrayDocument;
}

got an exception:

Cannot convert org.omnifaces.el.ExpressionInspector$FinalBaseHolder@140f4b22 of type class org.omnifaces.el.ExpressionInspector$FinalBaseHolder to class java.lang.Integer

jsf 2.2.12, Tomcat 8.0.14, jdk 8, omnifaces 2.1

BalusC
  • 1,082,665
  • 372
  • 3,610
  • 3,555
Nikola
  • 624
  • 1
  • 14
  • 31
  • I can't reproduce the problem based on the relevant information provided so far (but with Tomcat 8.0.26 instead of 8.0.14, so perhaps that makes difference). Please create a MCVE as asked in http://stackoverflow.com/tags/jsf/info. In my case, I used this MCVE: http://pastebin.com/wfD9hTPu – BalusC Oct 06 '15 at 17:54
  • @BalusC The problem was that I was using old version of el-impl (jboss-el 2.0.1.GA) and not container based. When I changed that, problem is gone. Thanks. – Nikola Oct 07 '15 at 09:58

1 Answers1

0

As per the comments, the problem is already solved by the OP.

The problem was that I was using old version of el-impl (jboss-el 2.0.1.GA) and not container based. When I changed that, problem is gone. Thanks.

BalusC
  • 1,082,665
  • 372
  • 3,610
  • 3,555