5 Replies Latest reply on Jul 7, 2010 7:16 AM by Rinuz _K

    dataTable binding problem

    Rinuz _K Newbie

      HI,

      I am new in richFaces and i want to create dynamic data table using binding, but i have some error. Please help me..

       

      {code}

      package pl.gov.straz.spd.core;

       

      import java.util.ArrayList;

      import java.util.List;

       

      import org.jboss.seam.ScopeType;

      import org.jboss.seam.annotations.Create;

      import org.jboss.seam.annotations.Factory;

      import org.jboss.seam.annotations.Name;

      import org.jboss.seam.annotations.Out;

      import org.jboss.seam.annotations.Scope;

      import org.jboss.seam.annotations.datamodel.DataModel;

      import org.jboss.seam.annotations.datamodel.DataModelSelection;

      import org.richfaces.component.UIDataTable;

      import org.richfaces.component.html.HtmlDataTable;

       

      import pl.gov.straz.spd.entity.EntityBase;

      import pl.gov.straz.spd.entity.Person;

       

      /**

      * Komponent przechowuje aktualnie wyświetlaną/edytowaną encję lub zbiór encji.

      * Encje są bindowane z elementami stron JSF

      *

      * @author Łukasz Maczułajtys

      */

      @Name("entityHolder")

      @Scope(ScopeType.EVENT)

      public class EntityHolder {

       

          java.util.logging.Logger loger = java.util.logging.Logger

              .getLogger(EntityHolder.class.getName());

       

          @Create

          public void create() {

          }

       

          public void EntityHolder() {

       

          }

       

          @DataModel

          private List<Person> entityList;

       

       

       

          private UIDataTable htmlDataTable;

       

          public UIDataTable getHtmlDataTable() {

       

          if (htmlDataTable == null) {

              htmlDataTable = new HtmlDataTable();

          }

          return htmlDataTable;

          }

       

          public void setHtmlDataTable(HtmlDataTable htmlDataTable) {

          this.htmlDataTable = htmlDataTable;

          }

       

          public void setEntityList(List<Person> entityList) {

          this.entityList = entityList;

          }

       

          @Factory("entityList")

          public void entityList() {

          if (entityList == null) {

              entityList = new ArrayList<Person>();

              entityList.add(new Person(new Long("1"), "Radek", "Kodruń", 22,

                  "Warszawa"));

              entityList.add(new Person(new Long("2"), "Jan", "Abacki", 22,

                  "Warszawa"));

              entityList.add(new Person(new Long("3"), "Jerzy", "Babackai", 22,

                  "Warszawa"));

              entityList.add(new Person(new Long("4"), "Mikołaj", "Cabacki", 22,

                  "Warszawa"));

              entityList.add(new Person(new Long("5"), "Anna", "Dabacka", 22,

                  "Warszawa"));

          }

          }

       

          public List<Person> getEntityList() {

       

          return entityList;

          }

       

       

      }

      {code}

       

      And xhtml code:

      {code:xml}<a4j:form id="itemListFrm">
                  <rich:dataTable value="#{entityHolder.entityList}" var="item"
                      binding="#{entityHolder.htmlDataTable}" />
              </a4j:form>{code:xml}

       

      Error that i have:

       

      {code}

      java.lang.IllegalArgumentException: Component itemListFrm:j_id17 not instance of org.richfaces.component.UIDataTable
           at org.ajax4jsf.renderkit.RendererBase.encodeBegin(RendererBase.java:93)
           at javax.faces.component.UIComponentBase.encodeBegin(UIComponentBase.java:802)
           at javax.faces.component.UIData.encodeBegin(UIData.java:950)
           at org.ajax4jsf.component.UIDataAdaptor.encodeBegin(UIDataAdaptor.java:1202)
           at javax.faces.component.UIComponent.encodeAll(UIComponent.java:934)
           at javax.faces.component.UIComponent.encodeAll(UIComponent.java:942)
           at javax.faces.component.UIComponent.encodeAll(UIComponent.java:942)
           at com.sun.facelets.FaceletViewHandler.renderView(FaceletViewHandler.java:592)
           at org.ajax4jsf.application.ViewHandlerWrapper.renderView(ViewHandlerWrapper.java:100)
           at org.ajax4jsf.application.AjaxViewHandler.renderView(AjaxViewHandler.java:176)
           at com.sun.faces.lifecycle.RenderResponsePhase.execute(RenderResponsePhase.java:110)
           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 com.ibm.ws.cache.servlet.ServletWrapper.serviceProxied(ServletWrapper.java:307)
           at com.ibm.ws.cache.servlet.CacheHook.handleFragment(CacheHook.java:571)
           at com.ibm.ws.cache.servlet.CacheHook.handleServlet(CacheHook.java:247)
           at com.ibm.ws.cache.servlet.ServletWrapper.service(ServletWrapper.java:259)
           at com.ibm.ws.webcontainer.servlet.ServletWrapper.service(ServletWrapper.java:1655)
           at com.ibm.ws.webcontainer.servlet.ServletWrapper.service(ServletWrapper.java:1595)
           at com.ibm.ws.webcontainer.filter.WebAppFilterChain.doFilter(WebAppFilterChain.java:131)
           at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:83)
           at org.jboss.seam.web.IdentityFilter.doFilter(IdentityFilter.java:40)
           at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
           at org.jboss.seam.web.MultipartFilter.doFilter(MultipartFilter.java:90)
           at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
           at org.jboss.seam.web.ExceptionFilter.doFilter(ExceptionFilter.java:64)
           at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
           at org.jboss.seam.web.LoggingFilter.doFilter(LoggingFilter.java:60)
           at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
           at org.jboss.seam.web.RedirectFilter.doFilter(RedirectFilter.java:45)
           at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
           at org.ajax4jsf.webapp.BaseXMLFilter.doXmlFilter(BaseXMLFilter.java:178)
           at org.ajax4jsf.webapp.BaseFilter.handleRequest(BaseFilter.java:290)
           at org.ajax4jsf.webapp.BaseFilter.processUploadsAndHandleRequest(BaseFilter.java:368)
           at org.ajax4jsf.webapp.BaseFilter.doFilter(BaseFilter.java:495)
           at org.jboss.seam.web.Ajax4jsfFilter.doFilter(Ajax4jsfFilter.java:56)
           at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
           at org.jboss.seam.web.HotDeployFilter.doFilter(HotDeployFilter.java:53)
           at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
           at org.jboss.seam.servlet.SeamFilter.doFilter(SeamFilter.java:158)
           at com.ibm.ws.webcontainer.filter.FilterInstanceWrapper.doFilter(FilterInstanceWrapper.java:188)
           at com.ibm.ws.webcontainer.filter.WebAppFilterChain.doFilter(WebAppFilterChain.java:116)
           at com.ibm.ws.webcontainer.filter.WebAppFilterChain._doFilter(WebAppFilterChain.java:77)
           at com.ibm.ws.webcontainer.filter.WebAppFilterManager.doFilter(WebAppFilterManager.java:895)
           at com.ibm.ws.webcontainer.servlet.ServletWrapper.handleRequest(ServletWrapper.java:932)
           at com.ibm.ws.webcontainer.servlet.ServletWrapper.handleRequest(ServletWrapper.java:500)
           at com.ibm.ws.webcontainer.servlet.ServletWrapperImpl.handleRequest(ServletWrapperImpl.java:178)
           at com.ibm.ws.webcontainer.webapp.WebApp.handleRequest(WebApp.java:3810)
           at com.ibm.ws.webcontainer.webapp.WebGroup.handleRequest(WebGroup.java:276)
           at com.ibm.ws.webcontainer.WebContainer.handleRequest(WebContainer.java:931)
           at com.ibm.ws.webcontainer.WSWebContainer.handleRequest(WSWebContainer.java:1583)
           at com.ibm.ws.webcontainer.channel.WCChannelLink.ready(WCChannelLink.java:183)
           at com.ibm.ws.http.channel.inbound.impl.HttpInboundLink.handleDiscrimination(HttpInboundLink.java:455)
           at com.ibm.ws.http.channel.inbound.impl.HttpInboundLink.handleNewInformation(HttpInboundLink.java:384)
           at com.ibm.ws.http.channel.inbound.impl.HttpICLReadCallback.complete(HttpICLReadCallback.java:83)
           at com.ibm.ws.tcp.channel.impl.AioReadCompletionListener.futureCompleted(AioReadCompletionListener.java:165)
           at com.ibm.io.async.AbstractAsyncFuture.invokeCallback(AbstractAsyncFuture.java:217)
           at com.ibm.io.async.AsyncChannelFuture.fireCompletionActions(AsyncChannelFuture.java:161)
           at com.ibm.io.async.AsyncFuture.completed(AsyncFuture.java:138)
           at com.ibm.io.async.ResultHandler.complete(ResultHandler.java:204)
           at com.ibm.io.async.ResultHandler.runEventProcessingLoop(ResultHandler.java:775)
           at com.ibm.io.async.ResultHandler$2.run(ResultHandler.java:905)
           at com.ibm.ws.util.ThreadPool$Worker.run(ThreadPool.java:1550)
      

      {code}

       

      Have anybody some idea how to solve the problem?

       

      Thank in advance.