0

I have a primefaces datatable listing all the files in a directory. In the datatable, there is a column which has the contents as a primefaces graphic image. I want it in a way so that when the user clicks on the image, it does the action I want it to. But right now, when I click on it, there is no action triggered. I have simplified the code and posted it below. What could be the optimal solution to this?

<p:dataTable 
    id="example"
    widgetVar="example"
    >
    <p:ajax event="rowSelect"
            listener="#{processController.action}"
            onstart="PF('blockUIWidget').block()"
            oncomplete="PF('blockUIWidget').unblock()"
            />
    <f:facet name="header">
        // some data
    </f:facet>
    <p:column headerText="Date" >
        // some data
    </p:column>
    <p:column headerText="FileName" >
        // some data
    </p:column>
    <p:column headerText="Select" >
        <p:commandLink actionListener="#{processController.action}" >
             <p:graphicImage value="resources/images/yes.png" />
        </p:commandLink />
    </p:column>
</p:dataTable>

I get the following error when I try to wrap graphic image around commandlink:

javax.el.MethodNotFoundException: Method not found: com.app.trial.controller.processController@7dd150cb.action()
Hello Man
  • 693
  • 2
  • 12
  • 29
  • @BalusC i did try that but i got the an error "method not found". but the method actually does exist. I have updated question with error – Hello Man Jun 03 '16 at 19:34
  • Could you show the bean signature and method then. Lower 'p' would be the standard – Jaqen H'ghar Jun 04 '16 at 07:07
  • Yes, true it is actually lower 'p'. I have edited the actual code and made it look simple so there was a typo. But the issue is the same. When i do a ctrl+click on the method name using netbeans, it takes me to the method correctly, which means i have specified it correctly right? @JaqenH'ghar I have updated the question now – Hello Man Jun 04 '16 at 07:39
  • And if you use action instead of actionListener? Does it get deployed at all? – Jaqen H'ghar Jun 04 '16 at 08:17
  • @JaqenH'ghar it gets deployed but i get the same error :/ – Hello Man Jun 04 '16 at 08:47
  • 1
    You mean the `MethodNotFoundException`? That's a different question. You'd have had exactly the same problem when using text instead of image in the command link. The `MethodNotFoundException` just means that the method is not present during runtime. It's really that simple. There are no other probable causes. Apparently clean/build/deploy/etc went bad, or there is some invisible typo. – BalusC Jun 05 '16 at 06:04

0 Answers0