Why does JSF not recognize the component id in the View?

Asked

Viewed 510 times

0

JSF is not recognizing the "dialogo-analyze" id that is in the view and is giving the error :

FATAL: Cannot find component for expression "dialogo-analise" referenced from "frmAtividade:tab:itens-rh:0:j_idt275".javax.faces.FacesException: Cannot find component for expression "dialogo-analise" referenced from "frmAtividade:tab:itens-rh:0:j_idt275".

Code I am called the

<p:commandLink title="Registrar Análise"
        oncomplete="PF('edicaoAnaliseRH').show()"
        action="#{atividadeBean.iniciarAnaliseRH(rh.id,rh.cpf)}"
        process="@this" update="dialogo-analise">
        <h:graphicImage value="/img/setas_2544_Run2.png" width="17"/>
</p:commandLink>

When I remove the "dialogue-analysis" dialog id, it works but does not do what I need. I am using the tabview of the first faces and the button is inside a datatable, in which I select a line. There is a method in my bean that I call before opening the dialog. I select some data in the table and try to display in this dialog. Debugging the data is assigned to attribute setters, but they are not displayed.... very strange.

Dialogue code

<p:dialog id="dialogo-analise" widgetVar="edicaoAnaliseRH" resizable="false" modal="true" closeOnEscape="true">
  • This problem is happening in the update?

  • Yes, when I include the dialog id, it gives the error that the component does not exist

  • The problem is not that it recognizes the id, it is not finding the id. They are within the same form?

  • Yes, they’re in the same form.

  • Has something to do with tabview?

  • Post your code to see how you rank your page.

  • Probably this is the component that is missing the ID: j_idt275

  • Do a test like this: update="j_idt275:dialogo-analise"

  • j_idt275 is probably his commandLink, you need to see where his dialog is to put the correct path in the commandLink update

  • 1

    If it’s outside tabview it’s probably update=":frmAtividade:dialogo-analise"

  • Rafael, it worked the way you described it. I put the dialog outside the tabview.... now I have another problem. When I finished updating this screen I was updating a datatable that was inside a tab. Now does not update anymore because I took the dialog tab. For me to update this datatable I need to inform all the way of this id, for example: frmAtivity:tabview:tab:datatable?

  • 1

    Yes, or you can update the entire tabview (if necessary). I will post an answer with the solution.

  • Rafael, blz.... Thanks so much for your help! Hugs

Show 8 more comments

1 answer

3


The problem is not that it recognizes the id but rather it is not finding the correct id path dialog.

the right way would be update=":frmAtividade:dialogo-analise".

Some components need to do this, for example tabView , dataTable and dialog, when doing an update out of them it is necessary to put the path, starting with the id of the form, up to the desired component.

An alternative is to use update="#{p:component('idComponente')}"

Browser other questions tagged

You are not signed in. Login or sign up in order to post.