6 Replies Latest reply on Nov 6, 2008 8:20 AM by ceduardo.roque

    Faces Components Disappear

    ceduardo.roque

      Hi everybody,

      I'm facing a strange issue regarding the usage of JSF Rich Faces components.
      I have a page with four text fields (<h:inputText) and two buttons.

      These buttons perform actions on the MB. One of them perform a query on the database and search some data on the database, populating a collection that is rendered by the rich:datatable on the page.

      The other button clear the table and the text fields, allowing the user to perform new queries and cleanups.

      BUT, sometimes, there is a WARN on JBoss log, that says:

      WARN [AjaxContext] Target component for id text1 not found


      After this, the components disappear from the page, as if they had been taken out of it.

      Has anybody passed by a situation like this?

      Thank you all!

        • 1. Re: Faces Components Disappear
          ilya_shaikovsky

          post your page code snippet.

          • 2. Re: Faces Components Disappear
            ceduardo.roque

            This is my code:

            <h:form id="form">
             <h:outputText rendered="true" id="messages" style="color: #FF0000;" binding="#{consultaObitoMB.messages}"/>
             <h:messages rendered="true" id="messages_faces"/>
             <h:panelGroup id="painel_pesquisa">
             <h:panelGrid id="grid_pesquisa" columns="2" styleClass="grid-link">
             <h:outputText id="lblNome" value="Nome:" rendered="true" />
             <h:inputText maxlength="76" id="nome"
             binding="#{consultaObitoMB.nome}" styleClass="text-large"
             rendered="true" />
             <h:outputText id="lblNomeMae" value="Nome da Mãe:" rendered="true" />
             <h:inputText maxlength="50" id="nomeMae"
             binding="#{consultaObitoMB.nomeDaMae}" styleClass="text-large"
             rendered="true" />
             <h:outputText id="lblCPF" value="CPF:" rendered="true" />
             <h:inputText maxlength="11" id="cpf"
             binding="#{consultaObitoMB.cpf}" styleClass="text-medium"
             rendered="true" />
             <h:outputText id="lblDtNasc" value="Data de Nascimento:"
             rendered="true" />
             <h:inputText maxlength="10" id="dtnasc"
             binding="#{consultaObitoMB.dataDeNascimento}"
             styleClass="text-small" rendered="true" />
             </h:panelGrid>
             </h:panelGroup>
             <br />
             <h:panelGroup id="painel_botoes">
             <h:commandButton rendered="true" id="botaoPesquisar"
             value="Pesquisar" action="#{consultaObitoMB.pesquisar}">
             <a4j:support id="btnPesquisar_ajax_suporte" event="onclick"
             reRender="nome, nomeMae, cpf, dtnasc, paginador, messages, tabela, dadosDoFalecido" />
             </h:commandButton>
             <h:commandButton id="botaoLimpar" rendered="true"
             action="#{consultaObitoMB.limpar}" value="Limpar campos">
             <a4j:support id="btnLimpar_ajax_suporte" event="onclick"
             reRender="nome, nomeMae, cpf, dtnasc, paginador, messages, tabela, dadosDoFalecido" />
             </h:commandButton>
             </h:panelGroup>
             <br />
             <br />
             <rich:dataTable binding="#{consultaObitoMB.tabela}" id="tabela"
             value="#{consultaObitoMB.registros}"
             onRowMouseOver="this.style.backgroundColor='#F1F1F1'"
             var="falecido"
             onRowMouseOut="this.style.backgroundColor='#{a4jSkin.tableBackgroundColor}'"
             cellpadding="0" cellspacing="0" rows="20"
             rendered="#{not empty consultaObitoMB.registros}" width="700"
             align="center" border="0">
             <rich:column id="coluna_header_nome">
             <f:facet name="header">
             <h:outputText id="lblHeaderNome" value="Nome" />
             </f:facet>
             <a4j:commandLink id="link"
             action="#{consultaObitoMB.recuperaDados}"
             value="#{falecido.nome}" reRender="dadosDoFalecido" />
             <rich:componentControl id="link_component_control"
             for="modalPainel" attachTo="link" operation="show"
             event="onclick" />
             </rich:column>
             <rich:column id="coluna_header_cpf">
             <f:facet name="header">
             <h:outputText id="lblHeaderCPF" value="CPF" />
             </f:facet>
             <h:outputText id="valorCPF" value="#{falecido.cpf}"></h:outputText>
             </rich:column>
             <rich:column id="coluna_header_data_obito">
             <f:facet name="header">
             <h:outputText id="lblHeaderObito" value="Data de Obito" />
             </f:facet>
             <h:outputText id="valor_dataObito" value="#{falecido.dataDeObito}"></h:outputText>
             </rich:column>
             </rich:dataTable>
             <center><t:dataScroller id="paginador" for="tabela"
             fastStep="20" styleClass="scroller"
             binding="#{consultaObitoMB.scroller}" paginator="true"
             paginatorMaxPages="100" paginatorRenderLinkForActive="false"
             paginatorActiveColumnStyle="font-weight:bold;"
             rendered="#{not empty consultaObitoMB.registros}"
             renderFacetsIfSinglePage="false">
            
             </t:dataScroller>


            Sorry for forgetting the code!
            Thank you!

            • 3. Re: Faces Components Disappear
              ilya_shaikovsky

              do not use support component on core action components :) a4j:commandButton provided for such usage out-of-the-box.

              • 4. Re: Faces Components Disappear
                ceduardo.roque

                 

                "ilya_shaikovsky" wrote:
                do not use support component on core action components :) a4j:commandButton provided for such usage out-of-the-box.


                Hi ilya,

                thank you for your answer.

                Actually I have already tried to use it, but I had problems on re-Rendering the dataTable.

                But I'll spend some time on it again and see if the problem stops.
                But, just for me to know, what is the cause of this "disappearing"? Is ther any bug with core components integrated to Rich faces components?

                Thank you again!

                • 5. Re: Faces Components Disappear
                  ilya_shaikovsky

                  this can't be named "integrated"... Have you realised that h:commandButton with support inside - just rises two requests? :) Let start with the clearing the code from wrogn constructions and it will help to solve concrete problems later ;)

                  • 6. Re: Faces Components Disappear
                    ceduardo.roque

                     

                    "ilya_shaikovsky" wrote:
                    this can't be named "integrated"... Have you realised that h:commandButton with support inside - just rises two requests? :) Let start with the clearing the code from wrogn constructions and it will help to solve concrete problems later ;)


                    Yes, I agree. Thank you.
                    By the way, I changed the <h:commandButton> to <a4j:commandButton>, and the error doesn't occur, but, another problem happens:

                    Now I have to refresh the page to see the changes, as if it was not refreshing the components. If I press the button, it performs its action, but nothing happens on the page. After I click refres on the browser (or F5), the result appears.

                    Is it missing something?

                    Thank you!