1 Reply Latest reply on Nov 10, 2008 5:07 AM by Konstantin Mishin

    problem with HtmlScrollableDataTable + ListDataModel

    Anil Langote Newbie

      Hi All

      I am trying to create the ListDataModel

      The code as below

      I have extended my class with HtmlScrollableDataTable

      public class MyClass extends HtmlScrollableDataTable {

      public static final String ROW_VAR = "row";

      public static final String ROW_KEY_VAR = "rkv";

      private List<List<String>> list = new ArrayList<List<String>>();

      @Override
      public String getRowKeyVar() {
      return ROW_KEY_VAR;
      }

      @Override
      public String getVar() {
      return ROW_VAR;
      }


      @Override
      public Object getValue() {
      DataModel data = new ListDataModel();
      //Here i am getting the list and creating dynamic columns
      // this list has columnheaders and the and the data
      String[] columnHeaders = workBecnhData.getColumnHeaders();
      data.setWrappedData(list );
      createColumns(columnHeaders );
      return data;
      }

      private void createColumns(String[] columnHeaders) {
      FacesContext context = FacesContext.getCurrentInstance();
      this.getChildren().clear();
      this.setRowKeyVar(ROW_KEY_VAR);
      this.setVar(ROW_VAR);
      for (int i = 0; i < list.get(0).size(); i++) {
      HtmlColumn column = new HtmlColumn();
      this.getChildren().add(column);
      HtmlOutputText header = new HtmlOutputText();
      header.setValue(columnHeaders);
      column.setHeader(header);
      HtmlOutputText output = new HtmlOutputText();
      output.setValueExpression("value", context.getApplication()
      .getExpressionFactory().createValueExpression(
      context.getELContext(),
      "#{" + ROW_VAR + "[" + i + "]}", String.class));
      column.getChildren().add(output);
      }
      }

      }


      Looks like successfully its creating the model and columns.

      but it throws following exception

      I use the following code on my facelet file

      <my:dataTag rows="3" height="200px" width="500px" objectType="ObjectType" />

      depending upon objectType gets the data from database

      It works fine if I use org.richfaces.component.html.HtmlDataTable and HtmlColumn






      Any Suggestions?


      javax.faces.FacesException: Exception while calling encodeEnd on component : {Component-Path : [Class: org.ajax4jsf.component.AjaxViewRoot,ViewId: /portals/Base/facelets/client/ws/SmAuthor/SmAuthor.xhtml][Class: org.apache.myfaces.custom.div.Div,Id: displayarea][Class: org.ajax4jsf.component.html.HtmlAjaxOutputPanel,Id: j_id22][Class: org.ajax4jsf.component.html.AjaxForm,Id: UISpecs_Workbench-f][Class: com.msc.sdm.ui.widget.toolkit.jsf.composite.FacesUILayout,Id: UISpecs_Workbench][Class: org.apache.myfaces.custom.div.Div,Id: j_id40][Class: org.apache.myfaces.custom.div.Div,Id: j_id44][Class: org.apache.myfaces.component.html.ext.HtmlPanelGroup,Id: j_id45]}
      at javax.faces.component.UIComponentBase.encodeEnd(UIComponentBase.java:610)
      at org.apache.myfaces.shared_tomahawk.renderkit.RendererUtils.renderChild(RendererUtils.java:522)
      at org.apache.myfaces.shared_tomahawk.renderkit.RendererUtils.renderChildren(RendererUtils.java:499)
      at org.apache.myfaces.custom.htmlTag.HtmlTagRenderer.encodeChildren(HtmlTagRenderer.java:86)
      at javax.faces.component.UIComponentBase.encodeChildren(UIComponentBase.java:594)
      at org.apache.myfaces.shared_tomahawk.renderkit.RendererUtils.renderChild(RendererUtils.java:516)
      at org.apache.myfaces.shared_tomahawk.renderkit.RendererUtils.renderChildren(RendererUtils.java:499)
      at org.apache.myfaces.custom.htmlTag.HtmlTagRenderer.encodeChildren(HtmlTagRenderer.java:86)
      at javax.faces.component.UIComponentBase.encodeChildren(UIComponentBase.java:594)
      at org.ajax4jsf.renderkit.RendererBase.renderChild(RendererBase.java:282)
      at org.ajax4jsf.renderkit.RendererBase.renderChildren(RendererBase.java:262)
      at org.ajax4jsf.renderkit.RendererBase.renderChild(RendererBase.java:284)
      at org.ajax4jsf.renderkit.RendererBase.renderChildren(RendererBase.java:262)
      at org.ajax4jsf.renderkit.RendererBase.renderChild(RendererBase.java:284)
      at org.ajax4jsf.renderkit.RendererBase.renderChildren(RendererBase.java:262)
      at org.ajax4jsf.renderkit.html.AjaxOutputPanelRenderer.encodeChildren(AjaxOutputPanelRenderer.java:79)
      at javax.faces.component.UIComponentBase.encodeChildren(UIComponentBase.java:594)
      at org.apache.myfaces.shared_tomahawk.renderkit.RendererUtils.renderChild(RendererUtils.java:516)
      at org.apache.myfaces.shared_tomahawk.renderkit.RendererUtils.renderChildren(RendererUtils.java:499)
      at org.apache.myfaces.custom.htmlTag.HtmlTagRenderer.encodeChildren(HtmlTagRenderer.java:86)
      at javax.faces.component.UIComponentBase.encodeChildren(UIComponentBase.java:594)
      at org.ajax4jsf.renderkit.RendererBase.renderChild(RendererBase.java:282)
      at org.ajax4jsf.renderkit.AjaxChildrenRenderer.encodeAjaxComponent(AjaxChildrenRenderer.java:125)
      at org.ajax4jsf.renderkit.AjaxChildrenRenderer.encodeAjaxChildren(AjaxChildrenRenderer.java:68)
      at org.ajax4jsf.renderkit.AjaxChildrenRenderer.encodeAjaxComponent(AjaxChildrenRenderer.java:116)
      at org.ajax4jsf.renderkit.AjaxContainerRenderer.encodeAjax(AjaxContainerRenderer.java:123)
      at org.ajax4jsf.component.AjaxViewRoot.encodeAjax(AjaxViewRoot.java:673)
      at org.ajax4jsf.component.AjaxViewRoot.encodeChildren(AjaxViewRoot.java:544)
      at javax.faces.component.UIComponent.encodeAll(UIComponent.java:239)
      at com.sun.facelets.FaceletViewHandler.renderView(FaceletViewHandler.java:592)
      at org.ajax4jsf.application.ViewHandlerWrapper.renderView(ViewHandlerWrapper.java:108)
      at org.ajax4jsf.application.AjaxViewHandler.renderView(AjaxViewHandler.java:189)
      at org.apache.myfaces.lifecycle.RenderResponseExecutor.execute(RenderResponseExecutor.java:41)
      at org.apache.myfaces.lifecycle.LifecycleImpl.render(LifecycleImpl.java:140)
      at javax.faces.webapp.FacesServlet.service(FacesServlet.java:152)
      at com.msc.sdm.web.faces.SmFacesServlet.service(SmFacesServlet.java:130)
      at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:252)
      at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
      at com.msc.sdm.web.filters.ResolveFileFilter.smDoFilter(ResolveFileFilter.java:199)
      at com.msc.sdm.web.filters.ResolveFileFilter.doFilter(ResolveFileFilter.java:54)
      at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:202)
      at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
      at org.apache.myfaces.webapp.filter.ExtensionsFilter.doFilter(ExtensionsFilter.java:301)
      at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:202)
      at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
      at org.ajax4jsf.webapp.BaseXMLFilter.doXmlFilter(BaseXMLFilter.java:154)
      at org.ajax4jsf.webapp.BaseFilter.handleRequest(BaseFilter.java:260)
      at org.ajax4jsf.webapp.BaseFilter.processUploadsAndHandleRequest(BaseFilter.java:366)
      at org.ajax4jsf.webapp.BaseFilter.doFilter(BaseFilter.java:493)
      at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:202)
      at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
      at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:213)
      at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:178)
      at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:126)
      at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:105)
      at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:107)
      at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:148)
      at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:869)
      at org.apache.coyote.http11.Http11BaseProtocol$Http11ConnectionHandler.processConnection(Http11BaseProtocol.java:664)
      at org.apache.tomcat.util.net.PoolTcpEndpoint.processSocket(PoolTcpEndpoint.java:527)
      at org.apache.tomcat.util.net.LeaderFollowerWorkerThread.runIt(LeaderFollowerWorkerThread.java:80)
      at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:684)
      at java.lang.Thread.run(Thread.java:595)
      Caused by: javax.faces.FacesException: Exception while calling encodeEnd on component : {Component-Path : [Class: org.ajax4jsf.component.AjaxViewRoot,ViewId: /portals/Base/facelets/client/ws/SmAuthor/SmAuthor.xhtml][Class: org.apache.myfaces.custom.div.Div,Id: displayarea][Class: org.ajax4jsf.component.html.HtmlAjaxOutputPanel,Id: j_id22][Class: org.ajax4jsf.component.html.AjaxForm,Id: UISpecs_Workbench-f][Class: com.msc.sdm.ui.widget.toolkit.jsf.composite.FacesUILayout,Id: UISpecs_Workbench][Class: org.apache.myfaces.custom.div.Div,Id: j_id40][Class: org.apache.myfaces.custom.div.Div,Id: j_id44][Class: org.apache.myfaces.component.html.ext.HtmlPanelGroup,Id: j_id45][Class: com.msc.sdm.ui.widget.toolkit.jsf.basic.FacesPanel,Id: SMWorkbenchPage]}
      at javax.faces.component.UIComponentBase.encodeEnd(UIComponentBase.java:610)
      at org.apache.myfaces.shared_tomahawk.renderkit.RendererUtils.renderChild(RendererUtils.java:522)
      at org.apache.myfaces.shared_tomahawk.renderkit.RendererUtils.renderChildren(RendererUtils.java:499)
      at org.apache.myfaces.renderkit.html.ext.HtmlGroupRenderer.encodeEnd(HtmlGroupRenderer.java:71)
      at javax.faces.component.UIComponentBase.encodeEnd(UIComponentBase.java:607)
      ... 62 more
      Caused by: javax.faces.FacesException: Exception while calling encodeEnd on component : {Component-Path : [Class: org.ajax4jsf.component.AjaxViewRoot,ViewId: /portals/Base/facelets/client/ws/SmAuthor/SmAuthor.xhtml][Class: org.apache.myfaces.custom.div.Div,Id: displayarea][Class: org.ajax4jsf.component.html.HtmlAjaxOutputPanel,Id: j_id22][Class: org.ajax4jsf.component.html.AjaxForm,Id: UISpecs_Workbench-f][Class: com.msc.sdm.ui.widget.toolkit.jsf.composite.FacesUILayout,Id: UISpecs_Workbench][Class: org.apache.myfaces.custom.div.Div,Id: j_id40][Class: org.apache.myfaces.custom.div.Div,Id: j_id44][Class: org.apache.myfaces.component.html.ext.HtmlPanelGroup,Id: j_id45][Class: com.msc.sdm.ui.widget.toolkit.jsf.basic.FacesPanel,Id: SMWorkbenchPage][Class: org.apache.myfaces.component.html.ext.HtmlPanelGroup,Id: j_id50]}
      at javax.faces.component.UIComponentBase.encodeEnd(UIComponentBase.java:610)
      at org.apache.myfaces.shared_tomahawk.renderkit.RendererUtils.renderChild(RendererUtils.java:522)
      at org.apache.myfaces.shared_tomahawk.renderkit.html.HtmlGridRendererBase.renderChildren(HtmlGridRendererBase.java:231)
      at org.apache.myfaces.shared_tomahawk.renderkit.html.HtmlGridRendererBase.encodeEnd(HtmlGridRendererBase.java:102)
      at javax.faces.component.UIComponentBase.encodeEnd(UIComponentBase.java:607)
      ... 66 more
      Caused by: javax.faces.FacesException: Exception while calling encodeEnd on component : {Component-Path : [Class: org.ajax4jsf.component.AjaxViewRoot,ViewId: /portals/Base/facelets/client/ws/SmAuthor/SmAuthor.xhtml][Class: org.apache.myfaces.custom.div.Div,Id: displayarea][Class: org.ajax4jsf.component.html.HtmlAjaxOutputPanel,Id: j_id22][Class: org.ajax4jsf.component.html.AjaxForm,Id: UISpecs_Workbench-f][Class: com.msc.sdm.ui.widget.toolkit.jsf.composite.FacesUILayout,Id: UISpecs_Workbench][Class: org.apache.myfaces.custom.div.Div,Id: j_id40][Class: org.apache.myfaces.custom.div.Div,Id: j_id44][Class: org.apache.myfaces.component.html.ext.HtmlPanelGroup,Id: j_id45][Class: com.msc.sdm.ui.widget.toolkit.jsf.basic.FacesPanel,Id: SMWorkbenchPage][Class: org.apache.myfaces.component.html.ext.HtmlPanelGroup,Id: j_id50][Class: com.msc.sdm.ui.widget.toolkit.jsf.basic.FacesPanel,Id: WdWBwkbnch]}
      at javax.faces.component.UIComponentBase.encodeEnd(UIComponentBase.java:610)
      at org.apache.myfaces.shared_tomahawk.renderkit.RendererUtils.renderChild(RendererUtils.java:522)
      at org.apache.myfaces.shared_tomahawk.renderkit.RendererUtils.renderChildren(RendererUtils.java:499)
      at org.apache.myfaces.renderkit.html.ext.HtmlGroupRenderer.encodeEnd(HtmlGroupRenderer.java:71)
      at javax.faces.component.UIComponentBase.encodeEnd(UIComponentBase.java:607)
      ... 70 more
      Caused by: javax.faces.FacesException: Exception while calling encodeEnd on component : {Component-Path : [Class: org.ajax4jsf.component.AjaxViewRoot,ViewId: /portals/Base/facelets/client/ws/SmAuthor/SmAuthor.xhtml][Class: org.apache.myfaces.custom.div.Div,Id: displayarea][Class: org.ajax4jsf.component.html.HtmlAjaxOutputPanel,Id: j_id22][Class: org.ajax4jsf.component.html.AjaxForm,Id: UISpecs_Workbench-f][Class: com.msc.sdm.ui.widget.toolkit.jsf.composite.FacesUILayout,Id: UISpecs_Workbench][Class: org.apache.myfaces.custom.div.Div,Id: j_id40][Class: org.apache.myfaces.custom.div.Div,Id: j_id44][Class: org.apache.myfaces.component.html.ext.HtmlPanelGroup,Id: j_id45][Class: com.msc.sdm.ui.widget.toolkit.jsf.basic.FacesPanel,Id: SMWorkbenchPage][Class: org.apache.myfaces.component.html.ext.HtmlPanelGroup,Id: j_id50][Class: com.msc.sdm.ui.widget.toolkit.jsf.basic.FacesPanel,Id: WdWBwkbnch][Class: com.msc.sdm.ui.widget.toolkit.jsf.basic.FacesWorkBench,Id: j_id51]}
      at javax.faces.component.UIComponentBase.encodeEnd(UIComponentBase.java:610)
      at javax.faces.component.UIData.encodeEnd(UIData.java:533)
      at org.richfaces.component.UIScrollableDataTable.encodeEnd(UIScrollableDataTable.java:353)
      at org.apache.myfaces.shared_tomahawk.renderkit.RendererUtils.renderChild(RendererUtils.java:522)
      at org.apache.myfaces.shared_tomahawk.renderkit.html.HtmlGridRendererBase.renderChildren(HtmlGridRendererBase.java:231)
      at org.apache.myfaces.shared_tomahawk.renderkit.html.HtmlGridRendererBase.encodeEnd(HtmlGridRendererBase.java:102)
      at javax.faces.component.UIComponentBase.encodeEnd(UIComponentBase.java:607)
      ... 74 more
      Caused by: java.lang.NullPointerException: expr
      at javax.faces.component.UIComponentBase.findComponent(UIComponentBase.java:407)
      at org.richfaces.renderkit.html.ScrollableDataTableBaseRenderer.getColumnSorting(ScrollableDataTableBaseRenderer.java:947)
      at org.richfaces.renderkit.html.ScrollableDataTableBaseRenderer.access$300(ScrollableDataTableBaseRenderer.java:45)
      at org.richfaces.renderkit.html.ScrollableDataTableBaseRenderer$2.renderContent(ScrollableDataTableBaseRenderer.java:161)
      at org.richfaces.renderkit.html.ExtendedColumnVisitor.visit(ExtendedColumnVisitor.java:31)
      at org.richfaces.renderkit.html.ColumnWalker.iterateOverColumns(ColumnWalker.java:43)
      at org.richfaces.renderkit.html.ScrollableDataTableBaseRenderer.renderHeaders(ScrollableDataTableBaseRenderer.java:544)
      at org.richfaces.renderkit.html.ScrollableDataTableRenderer.doEncodeEnd(ScrollableDataTableRenderer.java:343)
      at org.richfaces.renderkit.html.ScrollableDataTableRenderer.doEncodeEnd(ScrollableDataTableRenderer.java:602)
      at org.ajax4jsf.renderkit.RendererBase.encodeEnd(RendererBase.java:135)
      at org.richfaces.renderkit.html.ScrollableDataTableBaseRenderer.encodeEnd(ScrollableDataTableBaseRenderer.java:830)
      at javax.faces.component.UIComponentBase.encodeEnd(UIComponentBase.java:607)
      ... 80 more