1 Reply Latest reply on Aug 26, 2007 3:43 PM by Matt Drees

    Seam Pros, Newbie needs help. DataTable

    Casey Boyd Novice

      Seam: 2.0.0BETA1
      JBoss: 4.2.0
      Facelets

      I am having problems with a very simple datatable.

      Here is my code....

      Bean

      
      @Name("usermanager")
      @Stateful
      @Scope(SESSION)
      @Restrict("#{identity.loggedIn}")
      public class UserManager implements UserManagerInterface {
      
       @In
       private User user;
      
       @In
       private Session inetworkDatabase;
      
       @Logger
       Log log;
      
       @DataModelSelection("users")
       @Out(required = false)
       private User selectedUser;
      
       @DataModel("users")
       private List<User> users;
      
       @Factory("users")
       public List<User> getUsers() {
      
       List<User> retUsers = null;
      
       try{
      
       if(user != null){
      
       Criteria criteria = inetworkDatabase.createCriteria(User.class);
      
       retUsers = criteria.list();
      
       }else{
      
       }
      
       }catch(Exception e){
      
       }
      
       return retUsers;
       }
      
       public void editUser(){
      
       log.info("**************************************** ");
      
       }
      
       @Remove
       public void destroy() { }
      }
      
      


      XHTML


      
      <!DOCTYPE composition PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
      
      <ui:composition xmlns="http://www.w3.org/1999/xhtml"
       xmlns:s="http://jboss.com/products/seam/taglib"
       xmlns:ui="http://java.sun.com/jsf/facelets"
       xmlns:f="http://java.sun.com/jsf/core"
       xmlns:h="http://java.sun.com/jsf/html"
       xmlns:rich="http://richfaces.ajax4jsf.org/rich"
       xmlns:a4j="https://ajax4jsf.dev.java.net/ajax"
       template="layout/template.xhtml">
      
       <ui:define name="body">
      
       <a4j:form ajaxSubmit="true">
      
       <rich:dataTable id="users"
       rows="10"
       onRowMouseOver="this.style.backgroundColor='#F1F1F1'"
       onRowMouseOut="this.style.backgroundColor='#{a4jSkin.tableBackgroundColor}'"
       var="usr"
       value="#{users}">
      
       <f:facet name="header">
       <rich:columnGroup>
       <rich:column><h:outputText value="Edit User" /></rich:column>
       <rich:column><h:outputText value="User Name" /></rich:column>
       <rich:column><h:outputText value="First Name" /></rich:column>
       <rich:column><h:outputText value="Middle Name" /></rich:column>
       <rich:column><h:outputText value="Last Name" /></rich:column>
       </rich:columnGroup>
       </f:facet>
      
       <rich:column>
       <s:link action="#{usermanager.editUser}" value="#{usr.id}"/>
       </rich:column>
      
       <rich:column><h:outputText value="#{usr.username}" /></rich:column>
       <rich:column><h:outputText value="#{usr.firstname}" /></rich:column>
       <rich:column><h:outputText value="#{usr.middlename}" /></rich:column>
       <rich:column><h:outputText value="#{usr.lastname}" /></rich:column>
      
       </rich:dataTable>
      
       <rich:spacer height="20" />
      
       <rich:datascroller for="users" maxPages="50" />
      
       <rich:tabPanel switchType="client">
      
       <rich:tab label="Information">
      
       <h:panelGrid columns="2">
      
       <h:outputText value="First Name" />
       <h:inputText value="x" id="fname" />
      
       <h:outputText value="Middle Name" />
       <h:inputText value="b" id="mname" />
      
       <h:outputText value="Last Name" />
       <h:inputText value="c" id="lname" />
      
       </h:panelGrid>
      
       </rich:tab>
      
       <rich:tab label="Roles">
      
       this is where the users roles are listed
      
       </rich:tab>
      
       </rich:tabPanel>
      
       </a4j:form>
      
       </ui:define>
      
      </ui:composition>
      
      


      Every thing is ok at startup...

      But when i click on the slink, i get this...

      
      14:56:56,515 ERROR [SeamPhaseListener] uncaught exception
      javax.el.ELException: javax.ejb.EJBException: java.lang.ClassCastException: java.util.ArrayList cannot be cast to javax.faces.model.DataModel
      
      


      Why is that?

      I know this is a pretty easy question, my apologies, but any help would be really appreciated...

      Thanks

      indy