3 Replies Latest reply on Jul 6, 2010 4:51 AM by Sonam Wangdi

    javax.servlet.ServletException: could not find dataTable with id 'dt2'

    Sonam Wangdi Newbie

      Hi All,

       

      Suppose I have three closeable tabs (for example tab1, tab2 and tab3) each with their own datatables (dt1, dt2 and dt3) and datascrollers (ds1, ds2 and ds3). Now the problem is if I try closing any tab before the one that is open at the moment, it throws an error. For example, if tab2 is open, then closing tab2 or tab3 works fine but closing tab1 throws an error. Similarly, if tab3 is open, then closing tab3 works fine but closing either tab1 or tab2 throws an error. The error I get when I try to close tab2 (with tab3 being open) is:

       

      javax.servlet.ServletException: could not find dataTable with id 'dt2'
           javax.faces.webapp.FacesServlet.service(FacesServlet.java:277)
           org.ajax4jsf.webapp.BaseXMLFilter.doXmlFilter(BaseXMLFilter.java:178)
           org.ajax4jsf.webapp.BaseFilter.handleRequest(BaseFilter.java:290)
           org.ajax4jsf.webapp.BaseFilter.processUploadsAndHandleRequest(BaseFilter.java:388)
           org.ajax4jsf.webapp.BaseFilter.doFilter(BaseFilter.java:515)
      
      
      root cause
      java.lang.IllegalArgumentException: could not find dataTable with id 'dt2'
           org.richfaces.component.UIDatascroller.getDataTable(UIDatascroller.java:239)
           org.richfaces.component.RenderPhaseDataScrollerVisitor.beforeComponent(RenderPhaseDataScrollerVisitor.java:102)
           org.richfaces.event.RenderPhaseComponentListener.processComponents(RenderPhaseComponentListener.java:47)
           org.richfaces.event.RenderPhaseComponentListener.processComponents(RenderPhaseComponentListener.java:55)
           org.richfaces.event.RenderPhaseComponentListener.processComponents(RenderPhaseComponentListener.java:55)
           org.richfaces.event.RenderPhaseComponentListener.processComponents(RenderPhaseComponentListener.java:55)
           org.richfaces.event.RenderPhaseComponentListener.processComponents(RenderPhaseComponentListener.java:55)
           org.richfaces.event.RenderPhaseComponentListener.processComponents(RenderPhaseComponentListener.java:55)
           org.richfaces.event.RenderPhaseComponentListener.processComponents(RenderPhaseComponentListener.java:55)
           org.richfaces.event.RenderPhaseComponentListener.processComponents(RenderPhaseComponentListener.java:55)
           org.richfaces.event.RenderPhaseComponentListener.processComponents(RenderPhaseComponentListener.java:55)
           org.richfaces.event.RenderPhaseComponentListener.processComponents(RenderPhaseComponentListener.java:55)
           org.richfaces.event.RenderPhaseComponentListener.beforePhase(RenderPhaseComponentListener.java:71)
           org.ajax4jsf.component.AjaxViewRoot.processPhaseListeners(AjaxViewRoot.java:183)
           org.ajax4jsf.component.AjaxViewRoot.encodeBegin(AjaxViewRoot.java:505)
           javax.faces.component.UIComponent.encodeAll(UIComponent.java:928)
           com.sun.facelets.FaceletViewHandler.renderView(FaceletViewHandler.java:592)
           easa.server.beans.newjsf.CustomViewHandler.renderView(CustomViewHandler.java:62)
           org.ajax4jsf.application.ViewHandlerWrapper.renderView(ViewHandlerWrapper.java:100)
           org.ajax4jsf.application.AjaxViewHandler.renderView(AjaxViewHandler.java:176)
           com.sun.faces.lifecycle.RenderResponsePhase.execute(RenderResponsePhase.java:110)
           com.sun.faces.lifecycle.Phase.doPhase(Phase.java:100)
           com.sun.faces.lifecycle.LifecycleImpl.render(LifecycleImpl.java:139)
           javax.faces.webapp.FacesServlet.service(FacesServlet.java:266)
           org.ajax4jsf.webapp.BaseXMLFilter.doXmlFilter(BaseXMLFilter.java:178)
           org.ajax4jsf.webapp.BaseFilter.handleRequest(BaseFilter.java:290)
           org.ajax4jsf.webapp.BaseFilter.processUploadsAndHandleRequest(BaseFilter.java:388)
           org.ajax4jsf.webapp.BaseFilter.doFilter(BaseFilter.java:515)
      
      

       

      I don't know why this error is being thrown, since the datatable it is looking for is on the tab that has just been closed. Any help would be appreciated!

       

      Thanks,

       

      Sonam

        • 2. Re: javax.servlet.ServletException: could not find dataTable with id 'dt2'
          Sonam Wangdi Newbie

          Hi Akaine,

           

          Thank you for your reply. Please find below the code for the TabPanel:

           

          <a4j:outputPanel id="pnlAuthor" rendered="#{home.mode == 'author'}">
          <rich:tabPanel id="tpAuthor" tabClass="mainmenu-tab" contentClass="mainmenu-content" selectedTab="#{easaps.selectedTab}">
          <c:forEach items="#{easaps.tabs}" var="tab">
          <rich:tab id="#{tab.id}" style="#{tab.style}">
          <f:facet name="label">
          <h:panelGroup>
          <h:outputText value="#{tab.label}" rendered="#{!tab.closeable}"/>
          <h:panelGrid columns="2" rendered="#{tab.closeable}" cellspacing="0" cellpadding="0">
          <h:outputText value="#{tab.label}" />
          <h:graphicImage value="images/delete_grey.png" height="11" style="margin-left: 7px" onclick="deleteTab('#{tab.id}'); Event.stop(event);"/>
          </h:panelGrid>
          </h:panelGroup>
          </f:facet>
          <ui:include src="#{tab.include}" />
          </rich:tab>
          </c:forEach>
          </rich:tabPanel>
          </a4j:outputPanel>
           
          <h:form>
          <a4j:jsFunction action="#{easaps.removeTab}" name="deleteTab" id="deleteFunc"
               ajaxSingle="true" reRender="pnlAuthor">
               <a4j:actionparam name="tabId"/>
          </a4j:jsFunction>
          </h:form>
          

           

          The removeTab method is shown below:

           

           

               public void removeTab(){
                    String tabId = FacesContext.getCurrentInstance().getExternalContext().getRequestParameterMap().get("tabId");
                    if(tabId != null){
                         MenuTab tab = tabMap.get(tabId);
                         if(tab != null){
                              menu.removeTab("author", tab);
                              tabMap.remove(tabId);
                         }
                    }
                    
                     //set first tab as selected if current selected tab is closed
                    if(menu.getSelectedTab().equals(tabId))
                         menu.selectFirstTab();
               }
          

           

           

          Tabs are dynamically created and contains datatable and datascroller described previously.

           

          Thanks,

           

          Sonam

          • 3. Re: javax.servlet.ServletException: could not find dataTable with id 'dt2'
            Sonam Wangdi Newbie

            hi guys,

             

            still no luck with fixing this... an ideas?

             

            thanks,

             

            sonam