0
votes

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

2
replace actionListener with action like <p:commandLink action="#{requerimentoBean.prepareEdition(entity)}">. You actionListener binding method should have a signature like public void method(ActionEvent event) - Srikanth Ganji
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
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
Eu estou tentando editar um registro passando o id dele por parametro, algo assim: <p:commandLink id="edit" action="#{requerimentoBean.prepareEdition(entity.id)}" update=":frm" value="Editar"> tudo isso dentro de um <p:dataTable>... Mas eu nao consigo entrar no metido public void edition(ActionEvent event)... obrigada - Ruth

2 Answers

0
votes

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>
0
votes

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.