0 Replies Latest reply on May 26, 2007 6:03 AM by Tat'yana Demidova

    RunTimeException in rich:datatable

    Tat'yana Demidova Newbie

      Hello, I am sorry for my English.
      I am using Trinidad, MyFaces, RichFases and Ajax4Jsf.
      My problem: if I quickly click on table row, take place
      RunTimeException.

      my page:

      <?xml version='1.0' encoding='windows-1251'?>
      <jsp:root xmlns:jsp="http://java.sun.com/JSP/Page" version="2.0"
       xmlns:f="http://java.sun.com/jsf/core"
       xmlns:h="http://java.sun.com/jsf/html"
       xmlns:tr="http://myfaces.apache.org/trinidad"
       xmlns:rich="http://richfaces.ajax4jsf.org/rich">
       <f:loadBundle basename="ru.csbi.webapp.resources.UIResources" var="res" />
      
       <jsp:directive.page contentType="text/html;charset=windows-1251" />
       <f:view>
       <tr:document>
       <h:form id="form1">
       <rich:dataTable id="data_list" binding="#{employee.datatable}">
      
       </rich:dataTable>
       </h:form>
       </tr:document>
       </f:view>
      </jsp:root>


      myBean:
      import java.util.ArrayList;
      import java.util.List;
      
      import javax.faces.event.AbortProcessingException;
      import javax.faces.event.ActionEvent;
      import javax.faces.event.ActionListener;
      
      import org.ajax4jsf.ajax.html.HtmlAjaxSupport;
      import org.apache.myfaces.trinidad.component.core.output.CoreOutputText;
      import org.richfaces.component.html.HtmlColumn;
      import org.richfaces.component.html.HtmlDataTable;
      
      
      public class Employee
      {
       public class SelectRow implements ActionListener
       {
       public SelectRow()
       {
      
       }
      
       public void processAction(ActionEvent actionEvent) throws AbortProcessingException
       {
       for (int i = 0; i < 10000; i++)
       {
       System.out.println(i);
       }
       }
      
       }
      
       public Employee()
       {
       System.out.println("constructor");
       myDataList = new ArrayList<String>();
       myDataList.add("1");
       myDataList.add("1");
       myDataList.add("1");
       datatable = new HtmlDataTable();
       datatable.setVar("p");
       datatable.setValue(myDataList);
      
       HtmlAjaxSupport as = new HtmlAjaxSupport();
       as.setEvent("onRowClick");
       as
       .setOnsubmit("for(var n=0; n<this.parentElement.children.length;n++){this.parentElement.children[n].style.backgroundColor='#B5CCD9';}this.style.backgroundColor='#F1F1F1';");
       as.addActionListener(new SelectRow());
       datatable.getFacets().put("first", as);
      
       HtmlColumn col1 = new HtmlColumn();
       CoreOutputText head1 = new CoreOutputText();
       head1.setValue("item1");
       col1.setHeader(head1);
       CoreOutputText text1 = new CoreOutputText();
       text1.setValue("text1");
       col1.getChildren().add(text1);
       HtmlColumn col2 = new HtmlColumn();
       CoreOutputText head2 = new CoreOutputText();
       head2.setValue("item2");
       col2.setHeader(head2);
       CoreOutputText text2 = new CoreOutputText();
       text2.setValue("text2");
       col2.getChildren().add(text2);
       datatable.getChildren().add(col1);
       datatable.getChildren().add(col2);
      
       }
      
       public List<String> myDataList;
      
       public List<String> getMyDataList()
       {
       return myDataList;
       }
      
      public HtmlDataTable datatable;
      
       public HtmlDataTable getDatatable()
       {
       return datatable;
       }
      
       public void setDatatable(HtmlDataTable datatable)
       {
       this.datatable = datatable;
       }
      }


      and Exception
      java.lang.RuntimeException: Could not restore StateHolder of type Employee$SelectRow (missing no-args constructor?)
       at javax.faces.component.UIComponentBase.restoreAttachedState(UIComponentBase.java:894)
       at javax.faces.component.UIComponentBase.restoreAttachedState(UIComponentBase.java:880)
       at javax.faces.component.UIComponentBase.restoreState(UIComponentBase.java:950)
       at javax.faces.component.UICommand.restoreState(UICommand.java:189)
       at org.ajax4jsf.ajax.html.HtmlAjaxSupport.restoreState(HtmlAjaxSupport.java:637)
       at javax.faces.component.UIComponentBase.processRestoreState(UIComponentBase.java:728)
       at org.apache.myfaces.trinidad.component.TreeState.restoreState(TreeState.java:100)
       at org.apache.myfaces.trinidad.component.UIXComponentBase.processRestoreState(UIXComponentBase.java:833)
       at org.apache.myfaces.trinidad.component.TreeState.restoreState(TreeState.java:100)
       at org.apache.myfaces.trinidad.component.UIXComponentBase.processRestoreState(UIXComponentBase.java:833)
       at org.apache.myfaces.trinidad.component.TreeState.restoreState(TreeState.java:100)
       at org.apache.myfaces.trinidad.component.UIXComponentBase.processRestoreState(UIXComponentBase.java:833)
       at org.apache.myfaces.trinidad.component.TreeState.restoreState(TreeState.java:100)
       at org.apache.myfaces.trinidad.component.UIXComponentBase.processRestoreState(UIXComponentBase.java:833)
       at org.apache.myfaces.trinidad.component.TreeState.restoreState(TreeState.java:100)
       at org.apache.myfaces.trinidad.component.UIXComponentBase.processRestoreState(UIXComponentBase.java:833)
       at org.apache.myfaces.trinidad.component.TreeState.restoreState(TreeState.java:100)
       at org.apache.myfaces.trinidad.component.UIXComponentBase.processRestoreState(UIXComponentBase.java:833)
       at org.apache.myfaces.trinidad.component.TreeState.restoreState(TreeState.java:100)
       at org.apache.myfaces.trinidad.component.UIXComponentBase.processRestoreState(UIXComponentBase.java:833)
       at org.apache.myfaces.trinidad.component.TreeState.restoreState(TreeState.java:100)
       at org.apache.myfaces.trinidad.component.UIXComponentBase.processRestoreState(UIXComponentBase.java:833)
       at javax.faces.component.UIComponentBase.processRestoreState(UIComponentBase.java:719)
       at org.apache.myfaces.trinidadinternal.application.StateManagerImpl.restoreView(StateManagerImpl.java:455)
       at org.ajax4jsf.framework.ajax.AjaxStateManager.restoreView(AjaxStateManager.java:83)
       at org.apache.myfaces.application.jsp.JspViewHandlerImpl.restoreView(JspViewHandlerImpl.java:255)
       at org.ajax4jsf.framework.ViewHandlerWrapper.restoreView(ViewHandlerWrapper.java:116)
       at org.ajax4jsf.framework.ajax.AjaxViewHandler.restoreView(AjaxViewHandler.java:147)
       at org.apache.myfaces.trinidadinternal.application.ViewHandlerImpl.restoreView(ViewHandlerImpl.java:266)
       at org.ajax4jsf.framework.ViewHandlerWrapper.restoreView(ViewHandlerWrapper.java:116)
       at org.ajax4jsf.framework.ajax.AjaxViewHandler.restoreView(AjaxViewHandler.java:147)
       at org.apache.myfaces.lifecycle.LifecycleImpl.restoreView(LifecycleImpl.java:141)
       at org.apache.myfaces.lifecycle.LifecycleImpl.execute(LifecycleImpl.java:66)
       at javax.faces.webapp.FacesServlet.service(FacesServlet.java:137)
       at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:252)
       at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
       at org.apache.myfaces.trinidadinternal.webapp.TrinidadFilterImpl._invokeDoFilter(TrinidadFilterImpl.java:210)
       at org.apache.myfaces.trinidadinternal.webapp.TrinidadFilterImpl._doFilterImpl(TrinidadFilterImpl.java:167)
       at org.apache.myfaces.trinidadinternal.webapp.TrinidadFilterImpl.doFilter(TrinidadFilterImpl.java:140)
       at org.apache.myfaces.trinidad.webapp.TrinidadFilter.doFilter(TrinidadFilter.java:93)
       at ru.csbi.webapp.filters.TrinidadExt.doFilter(TrinidadExt.java:18)
       at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:202)
       at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
       at org.ajax4jsf.framework.ajax.xmlfilter.BaseXMLFilter.doXmlFilter(BaseXMLFilter.java:96)
       at org.ajax4jsf.framework.ajax.xmlfilter.BaseFilter.doFilter(BaseFilter.java:220)
       at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:202)
       at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173) ... 64 more


      Can somebody help me? What wrong?