0

Hello I am using JSF and PrimeFaces 3.5 2.1.17, I have the code below:

<p:dataTable id="resultTable" var="entity" value="#{requerimentoBean.entitys}" >
    <p:column style="width: 22px;">
        <p:commandLink actionListener="#{requerimentoBean.prepareEdition(entity)}">
            <h:graphicImage library="images" title="Editar" name="edit.png" style="border: none;" />
        </p:commandLink>
    </p:column>
</p:dataTable>

the problem occurs on this line:

<p:commandLink actionListener="#{requerimentoBean.prepareEdition(entity)}">

Error occurs when I place the entity parameter. the method can not prepareEdition is accessor.

public void prepareEdition(Requerimento entity){
    System.out.println("***** Método preperaEdition ****");
    System.out.println("***** ID: " + entity.getId() + "*****");
    setEntity(logic.getById(entity.getId()));
}

if you can help thanks

LaurentG
  • 11,128
  • 9
  • 51
  • 66
Ruth
  • 21
  • 1
  • 3
  • 6
  • replace actionListener with action like . You actionListener binding method should have a signature like public void method(ActionEvent event) – Srikanth Ganji Mar 13 '14 at 07:20
  • There are accessing the method public void prepareEdition (ActionEvent event), I'm using 2.1.17 JSF 2.5 and PrimeFaces would versioning problem with? importing: import javax.faces.event.ActionEvent; – Ruth Mar 13 '14 at 13:35
  • You can't pass entity object as a parameters. Replace as I metioned. I haven't understood what exactly you trying to say. Can you elaborate? – Srikanth Ganji Mar 13 '14 at 13:57
  • Eu estou tentando editar um registro passando o id dele por parametro, algo assim: tudo isso dentro de um ... Mas eu nao consigo entrar no metido public void edition(ActionEvent event)... obrigada – Ruth Mar 13 '14 at 15:24

2 Answers2

0

This is how you pass objects

<p:commandLink
    actionListener="#{requerimentoBean.prepareEdition()}">
    <h:graphicImage library="images" title="Editar" name="edit.png"
        style="border: none;" />
    <f:setPropertyActionListener target="#{requerimentoBean.entityObj}"
        value="#{entity}" />
</p:commandLink>
Dileep
  • 5,362
  • 3
  • 22
  • 38
0

Replace actionListener with action like

 <p:commandLink process="@this"  
                action="#{requerimentoBean.prepareEdition(entity)}">.   

You actionListener binding method should have a signature like

  public void method(ActionEvent event)  

Hope this helps.

Srikanth Ganji
  • 1,127
  • 1
  • 13
  • 29