Update event in "p:commandLink" component does not render

Asked

Viewed 621 times

1

I have a datatable presented within a Dialog primefaces, when I click on commandLink of the line I desire, I want to take that value and render it within a inputText from my screen, but I’m getting the following error in my event update.

error: javax.faces.Facesexception: Cannot find Component with Expression "gerSup"

'Cause he’s not identifying my id inputText? I don’t know if it’s possible to do what I’m trying to do, but if anyone knows I could get the tip.

My inputText on the main screen

<p:inputText id="gerSup" value="#{funcionarioBean.funcionario.pessoa.nomePessoa}" style="width:270px; margin-left: 6px;"/>

Man p:dialog where I click on commandLink first column

<p:dialog header="Buscar Gerentes Cadastrados" height="300" width="750" widgetVar="gerDialog" modal="true" showEffect="drop" hideEffect="drop" resizable="false">
  <br/>
  <p:outputPanel id="getDetail" style="text-align:center;">

    <h:panelGrid columns="3">
      <h:outputText value="Buscar Gerente: " style="margin-left: 8px;" />
      <p:spacer width="5" />
      <p:inputText style="width:250px;" onkeyup="this.value = this.value.toUpperCase()" />
    </h:panelGrid>
    <br/>

    <p:dataTable var="obj" value="#{funcionarioBean.listGerentesSupervisores}" rows="5" paginator="true" paginatorPosition="bottom">
      <f:facet name="header">
        Gerentes e Supervisores
      </f:facet>
      <p:column width="5%" style="text-align:center">
        <p:commandLink value="Submit" update="gerSup">
          <p:graphicImage value="/resources/img/icon/Accepted16X16.png" />
        </p:commandLink>
      </p:column>

      <p:column headerText="Código" width="10%;" style="text-align:center">
        <h:outputText value="#{obj.pessoa.codigoPessoa}" />
      </p:column>
      <p:column headerText="Nome" width="40%;" style="text-align:center">
        <h:outputText value="#{obj.pessoa.nomePessoa}" />
      </p:column>
      <p:column headerText="Cargo" width="40%;" style="text-align:center">
        <h:outputText value="#{obj.cargo.descricao}" />
      </p:column>
    </p:dataTable>
  </p:outputPanel>
</p:dialog>

Error message

22:25:02,918 ERROR [io.undertow.request] (default task-64) UT005023: Exception handling request to /sgc/cadastro/funcionario.xhtml: javax.servlet.ServletException: Cannot find component with expression "gerSup" referenced from "formFun:j_idt122:0:j_idt125".
    at javax.faces.webapp.FacesServlet.service(FacesServlet.java:659) [jboss-jsf-api_2.2_spec-2.2.8.jar:2.2.8]

Caused by: javax.faces.FacesException: Cannot find component with expression "gerSup" referenced from "formFun:j_idt122:0:j_idt125".
    at org.primefaces.expression.SearchExpressionFacade.resolveComponentInternal(SearchExpressionFacade.java:422) [primefaces-5.1.jar:5.1]
    at org.primefaces.expression.SearchExpressionFacade.resolveComponentForClient(SearchExpressionFacade.java:200) [primefaces-5.1.jar:5.1]
    at org.primefaces.expression.SearchExpressionFacade.resolveComponentsForClient(SearchExpressionFacade.java:147) [primefaces-5.1.jar:5.1]
    at org.primefaces.util.AjaxRequestBuilder.addExpressions(AjaxRequestBuilder.java:92) [primefaces-5.1.jar:5.1]
    at org.primefaces.util.AjaxRequestBuilder.update(AjaxRequestBuilder.java:85) [primefaces-5.1.jar:5.1]
    at org.primefaces.renderkit.CoreRenderer.buildAjaxRequest(CoreRenderer.java:356) [primefaces-5.1.jar:5.1]
    at org.primefaces.component.commandlink.CommandLinkRenderer.encodeEnd(CommandLinkRenderer.java:93) [primefaces-5.1.jar:5.1]
    at javax.faces.component.UIComponentBase.encodeEnd(UIComponentBase.java:919) [jboss-jsf-api_2.2_spec-2.2.8.jar:2.2.8]
    at javax.faces.component.UIComponent.encodeAll(UIComponent.java:1863) [jboss-jsf-api_2.2_spec-2.2.8.jar:2.2.8]
    at org.primefaces.component.column.Column.renderChildren(Column.java:304) [primefaces-5.1.jar:5.1]
    at org.primefaces.component.datatable.DataTableRenderer.encodeCell(DataTableRenderer.java:963) [primefaces-5.1.jar:5.1]
    at org.primefaces.component.datatable.DataTableRenderer.encodeRow(DataTableRenderer.java:919) [primefaces-5.1.jar:5.1]
    at org.primefaces.component.datatable.DataTableRenderer.encodeRows(DataTableRenderer.java:830) [primefaces-5.1.jar:5.1]
    at org.primefaces.component.datatable.DataTableRenderer.encodeTbody(DataTableRenderer.java:777) [primefaces-5.1.jar:5.1]
    at org.primefaces.component.datatable.DataTableRenderer.encodeTbody(DataTableRenderer.java:740) [primefaces-5.1.jar:5.1]
    at org.primefaces.component.datatable.DataTableRenderer.encodeRegularTable(DataTableRenderer.java:264) [primefaces-5.1.jar:5.1]
    at org.primefaces.component.datatable.DataTableRenderer.encodeMarkup(DataTableRenderer.java:226) [primefaces-5.1.jar:5.1]
    at org.primefaces.component.datatable.DataTableRenderer.encodeEnd(DataTableRenderer.java:85) [primefaces-5.1.jar:5.1]
    at javax.faces.component.UIComponentBase.encodeEnd(UIComponentBase.java:919) [jboss-jsf-api_2.2_spec-2.2.8.jar:2.2.8]
    at org.primefaces.renderkit.CoreRenderer.renderChild(CoreRenderer.java:83) [primefaces-5.1.jar:5.1]
    at org.primefaces.renderkit.CoreRenderer.renderChildren(CoreRenderer.java:66) [primefaces-5.1.jar:5.1]
    at org.primefaces.component.outputpanel.OutputPanelRenderer.encodeMarkup(OutputPanelRenderer.java:65) [primefaces-5.1.jar:5.1]
    at org.primefaces.component.outputpanel.OutputPanelRenderer.encodeEnd(OutputPanelRenderer.java:41) [primefaces-5.1.jar:5.1]
    at javax.faces.component.UIComponentBase.encodeEnd(UIComponentBase.java:919) [jboss-jsf-api_2.2_spec-2.2.8.jar:2.2.8]
    at org.primefaces.renderkit.CoreRenderer.renderChild(CoreRenderer.java:83) [primefaces-5.1.jar:5.1]
    at org.primefaces.renderkit.CoreRenderer.renderChildren(CoreRenderer.java:66) [primefaces-5.1.jar:5.1]
    at org.primefaces.component.dialog.DialogRenderer.encodeContent(DialogRenderer.java:180) [primefaces-5.1.jar:5.1]
    at org.primefaces.component.dialog.DialogRenderer.encodeMarkup(DialogRenderer.java:109) [primefaces-5.1.jar:5.1]
    at org.primefaces.component.dialog.DialogRenderer.encodeEnd(DialogRenderer.java:47) [primefaces-5.1.jar:5.1]
    at javax.faces.component.UIComponentBase.encodeEnd(UIComponentBase.java:919) [jboss-jsf-api_2.2_spec-2.2.8.jar:2.2.8]
    at javax.faces.component.UIComponent.encodeAll(UIComponent.java:1863) [jboss-jsf-api_2.2_spec-2.2.8.jar:2.2.8]
    at javax.faces.render.Renderer.encodeChildren(Renderer.java:176) [jboss-jsf-api_2.2_spec-2.2.8.jar:2.2.8]
    at javax.faces.component.UIComponentBase.encodeChildren(UIComponentBase.java:889) [jboss-jsf-api_2.2_spec-2.2.8.jar:2.2.8]
    at javax.faces.component.UIComponent.encodeAll(UIComponent.java:1856) [jboss-jsf-api_2.2_spec-2.2.8.jar:2.2.8]
    at javax.faces.component.UIComponent.encodeAll(UIComponent.java:1859) [jboss-jsf-api_2.2_spec-2.2.8.jar:2.2.8]
    at com.sun.faces.application.view.FaceletViewHandlingStrategy.renderView(FaceletViewHandlingStrategy.java:456) [jsf-impl-2.2.8-jbossorg-1.jar:]
    at com.sun.faces.application.view.MultiViewHandler.renderView(MultiViewHandler.java:133) [jsf-impl-2.2.8-jbossorg-1.jar:]
    at javax.faces.application.ViewHandlerWrapper.renderView(ViewHandlerWrapper.java:337) [jboss-jsf-api_2.2_spec-2.2.8.jar:2.2.8]
    at javax.faces.application.ViewHandlerWrapper.renderView(ViewHandlerWrapper.java:337) [jboss-jsf-api_2.2_spec-2.2.8.jar:2.2.8]
    at com.sun.faces.lifecycle.RenderResponsePhase.execute(RenderResponsePhase.java:120) [jsf-impl-2.2.8-jbossorg-1.jar:]
    at com.sun.faces.lifecycle.Phase.doPhase(Phase.java:101) [jsf-impl-2.2.8-jbossorg-1.jar:]
    at com.sun.faces.lifecycle.LifecycleImpl.render(LifecycleImpl.java:219) [jsf-impl-2.2.8-jbossorg-1.jar:]
    at javax.faces.webapp.FacesServlet.service(FacesServlet.java:647) [jboss-jsf-api_2.2_spec-2.2.8.jar:2.2.8]
    ... 31 more
  • Ederson, this component with id gerSup is outside the p:dialog?

  • Yes Wakim, you are.

  • Ederson, the problem is that this way, it does the search only from the nearest Namingcontainer (Dialog), for this you need to follow the rule: :NamingContainerId:OutroNamingContainerId:<quantos mais>:seuComponente or, I believe, that only :seuComponente must resolve. Take a look at this post for more details: http://blog.primefaces.org/? p=2740

  • Thanks, I’ll test, already tried :gerSup and also did not work as it also did not work this way :formFun :gerSup. I will read the post, thanks!

1 answer

1

Test as follows:

update="@form:gerSup"

In some versions jsf works with space.

update="@form gerSup"

Also test in place of @form the id of your form.

Take the test and tell us if it worked.

Browser other questions tagged

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