5 Replies Latest reply on Feb 12, 2009 8:05 PM by Nick Belaevski

    exception when nesting rich:dataTables

    Kip Moore Newbie

      i'm not sure if this is something i'm doing wrong, or if this is an actual bug. i'm trying to nest two rich:dataTables, one of which has a rich:datascroller attached to it. after a couple of clicks on the scroller my application crashes with an exception.

      my jsp page:

      <%@ page contentType="text/html; charset=UTF-8" %>
      <%@ taglib uri="http://java.sun.com/jsf/core" prefix="f" %>
      <%@ taglib uri="http://java.sun.com/jsf/html" prefix="h" %>
      <%@ taglib uri="http://richfaces.org/a4j" prefix="a4j"%>
      <%@ taglib uri="http://richfaces.org/rich" prefix="rich"%>
      
      <f:view>
       <html>
       <body>
      
       <a4j:form id="testbed_form">
      
       <rich:dataTable id = "outer_table"
       rows = "10"
       value = "#{TestbedBean.outerTableRows}"
       var = "outer_row">
      
       <rich:column>
       <f:facet name="header">
       <h:outputText value="Column 1"/>
       </f:facet>
       <h:outputText value="#{outer_row}"/>
       </rich:column>
      
       <rich:column>
       <f:facet name="header">
       <h:outputText value="Column 2"/>
       </f:facet>
       <h:outputText value="#{outer_row}"/>
       </rich:column>
      
       <rich:column>
       <f:facet name="header">
       <h:outputText value="Column 3"/>
       </f:facet>
       <h:outputText value="#{outer_row}"/>
       </rich:column>
      
       <rich:column>
       <f:facet name="header">
       <h:outputText value="Column 4"/>
       </f:facet>
       <h:outputText value="#{outer_row}"/>
       </rich:column>
      
       <rich:column>
       <f:facet name="header">
       <h:outputText value="Column 5"/>
       </f:facet>
       <h:outputText value="#{outer_row}"/>
       </rich:column>
      
       <rich:column>
       <f:facet name="header">
       <h:outputText value="Column 6"/>
       </f:facet>
       <h:outputText value="#{outer_row}"/>
       </rich:column>
      
       <rich:column>
       <f:facet name="header">
       <h:outputText value="Column 7"/>
       </f:facet>
       <rich:dataTable id = "inner_table"
       rows = "0"
       value = "#{TestbedBean.innerTableRows}"
       var = "inner_row">
       <rich:column>
       <f:facet name="header">
       <h:outputText value="Inner Column 1"/>
       </f:facet>
       <h:outputText value="#{inner_row}"/>
       </rich:column>
      
       <rich:column>
       <f:facet name="header">
       <h:outputText value="Inner Column 2"/>
       </f:facet>
       <h:outputText value="#{inner_row}"/>
       </rich:column>
       </rich:dataTable>
       </rich:column>
      
       </rich:dataTable>
       <rich:datascroller id="outer_scroller"
       for="outer_table"
       maxPages="10">
       </rich:datascroller>
      
       <rich:messages globalOnly="true"/>
       </a4j:form>
      
       </body>
       </html>
      </f:view>
      



      my backing bean, pretty simple:

      import java.util.ArrayList;
      import java.util.List;
      
      public class TestbedBean
      {
       public List getOuterTableRows()
       {
       ArrayList<String> retval = new ArrayList<String>();
      
       for(int i=1; i<=30; i++)
       {
       retval.add(Integer.toString(i));
       }
      
       return retval;
       }
      
       public List getInnerTableRows()
       {
       ArrayList<String> retval = new ArrayList<String>();
       retval.add("inner row");
       return retval;
       }
      
      }
      



      the exception (some stuff removed):

      java.lang.StringIndexOutOfBoundsException: srcBegin > srcEnd
       at java.lang.AbstractStringBuilder.getChars(AbstractStringBuilder.java:330)
       at com.sun.faces.renderkit.html_basic.HtmlResponseWriter.flushAttributes(HtmlResponseWriter.java:981)
       at com.sun.faces.renderkit.html_basic.HtmlResponseWriter.endElement(HtmlResponseWriter.java:489)
       at org.ajax4jsf.renderkit.AjaxRendererUtils.encodeAreas(AjaxRendererUtils.java:717)
       at org.ajax4jsf.renderkit.AjaxContainerRenderer.encodeAjax(AjaxContainerRenderer.java:125)
       at org.ajax4jsf.component.AjaxViewRoot.encodeAjax(AjaxViewRoot.java:641)
       at org.ajax4jsf.component.AjaxViewRoot.encodeChildren(AjaxViewRoot.java:512)
       at javax.faces.component.UIComponent.encodeAll(UIComponent.java:936)
       at com.sun.faces.application.ViewHandlerImpl.doRenderView(ViewHandlerImpl.java:271)
       at com.sun.faces.application.ViewHandlerImpl.renderView(ViewHandlerImpl.java:202)
       at org.ajax4jsf.application.ViewHandlerWrapper.renderView(ViewHandlerWrapper.java:108)
       at org.ajax4jsf.application.AjaxViewHandler.renderView(AjaxViewHandler.java:189)
       at com.sun.faces.lifecycle.RenderResponsePhase.execute(RenderResponsePhase.java:109)
       at com.sun.faces.lifecycle.Phase.doPhase(Phase.java:100)
       at com.sun.faces.lifecycle.LifecycleImpl.render(LifecycleImpl.java:139)
       at javax.faces.webapp.FacesServlet.service(FacesServlet.java:266)
       at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
       at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
       at org.ajax4jsf.webapp.BaseXMLFilter.doXmlFilter(BaseXMLFilter.java:147)
       at org.ajax4jsf.webapp.BaseFilter.handleRequest(BaseFilter.java:256)
       at org.ajax4jsf.webapp.BaseFilter.processUploadsAndHandleRequest(BaseFilter.java:362)
       at org.ajax4jsf.webapp.BaseFilter.doFilter(BaseFilter.java:488)
       at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
       at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
      ...
      



      1. this problem goes away if i use an h:dataTable as the inner table. this is a viable solution for me, but i'd really prefer to be able to use two rich:dataTables.

      2. this seems unrelated to my web.xml configuration. i've stripped out any richfaces parameters in my web.xml and it seems to have no effect.

      3. the page renders fine initially; it only crashes when i try to scroll through the outer table. oddly enough, it will sometimes allow me to scroll once, but not a second time.

      i'm using JBoss 4.2.2 GA, JSF RI (Mojarra) 1.2_08-b06-FCS, RichFaces 3.2.0.SR1, and Firefox 2.0.0.14.

      i'm pretty stumped by this and i suspect that i'm doing something wrong, but i have no idea what that would be. pretty much everything else in my application works great, until i try nesting rich:dataTables. any and all suggestions would be greatly appreciated. thanks!