1 Reply Latest reply on Jun 18, 2008 12:43 PM by Leonardo Pinho

    problems with <rich:columns>

    Jose Luis mesa munoz Newbie

      hello, whe i use the <rich:columns> i get this exception

      javax.servlet.jsp.JspTagException: FOREACH_BAD_ITEMS

      this my .jsf

      <%@taglib uri="http://java.sun.com/jsf/core" prefix="f"%><%@taglib
      uri="http://yui4jsf.sourceforge.net" prefix="yui"%><%@taglib
      uri="http://java.sun.com/jsf/html" prefix="h"%><%@taglib
      uri="http://www.jenia.org/jsf/popup" prefix="jp"%><%@taglib
      uri="http://richfaces.org/a4j" prefix="a4j"%><%@taglib
      uri="https://ajax4jsf.dev.java.net/ajax" prefix="ajax"%><%@taglib
      uri="http://richfaces.org/rich" prefix="rich"%><%@taglib
      uri="http://richfaces.ajax4jsf.org/rich" prefix="richfaces"%><%@taglib
      uri="http://java.sun.com/jstl/core" prefix="c"%>
      <%@ page language="java" contentType="text/html; charset=ISO-8859-1"
      pageEncoding="ISO-8859-1"%>
      <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">


      <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
      Insert title here





      <f:view>

      <h:form>
      <rich:scrollableDataTable binding="#{prueba.dt}" var="datos">

      <rich:columns value="#{prueba.columnas}" var="col" begin="0">

      <f:facet name="header">
      <h:outputText value="#{col.header}" />
      </f:facet>

      </rich:columns>

      </rich:scrollableDataTable>

      <h:commandButton value="Buscar" action="#{prueba.buscar_action}"></h:commandButton>


      </h:form>

      </f:view>




      this my backingbean



      package com.esoj.bd.comun;

      import java.util.ArrayList;

      import javax.faces.context.FacesContext;
      import javax.faces.model.ResultDataModel;
      import javax.servlet.http.HttpSession;
      import javax.servlet.jsp.jstl.sql.ResultSupport;


      import org.richfaces.component.html.HtmlScrollableDataTable;
      import org.richfaces.model.impl.ListDataModel;


      import com.esoj.bd.dao.CobrosDAO;
      import com.esoj.util.comun.ColumnsDataGrid;
      import com.sun.rowset.CachedRowSetImpl;

      public class Prueba{


      private CachedRowSetImpl crs = CobrosDAO.obtenerPagos();
      private HtmlScrollableDataTable dt = new HtmlScrollableDataTable();
      private ListDataModel columnas;


      HttpSession session = (HttpSession) FacesContext.getCurrentInstance().getExternalContext().getSession(true);

      public Prueba(){
      initColums();
      }

      public String buscar_action(){
      try {
      //CachedRowSetImp Object for DataTable value
      dt.setValue(new ResultDataModel(ResultSupport.toResult(CobrosDAO.obtenerPagos())));
      } catch (Exception e) {
      System.out.println("Error en el metodo buscar_action de la Clase Cobros: " + e.getMessage());
      }
      return "probando";
      }

      /**
      * @param crs the crs to set
      */
      public void setCrs(CachedRowSetImpl crs) {
      this.crs = crs;
      }

      /**
      * @return the crs
      */
      public CachedRowSetImpl getCrs() {
      return crs;
      }

      /**
      * @param dt the dt to set
      */
      public void setDt(HtmlScrollableDataTable dt) {
      this.dt = dt;
      }

      /**
      * @return the dt
      */
      public HtmlScrollableDataTable getDt() {
      return dt;
      }


      public void initColums(){
      ArrayList columns = new ArrayList();
      try {
      //JLMM Construimos los datos basicos para que se muestre el datagrid para esta seccion
      columns.add(new ColumnsDataGrid("pag_id","0",false,"ID",""));
      columns.add(new ColumnsDataGrid("pag_concepto","300",true,"Descripción",""));
      columns.add(new ColumnsDataGrid("pag_importe","50",true,"Importe",""));
      columns.add(new ColumnsDataGrid("pag_proveedor","300",true,"Proveedor",""));
      columns.add(new ColumnsDataGrid("pag_fvencimiento","200",true,"Fecha Vencimiento",""));
      columns.add(new ColumnsDataGrid("pag_fpago","100",true,"Forma Pago",""));
      columns.add(new ColumnsDataGrid("pag_banco","50",true,"Banco",""));
      columnas = new ListDataModel(columns);

      } catch (Exception e) {
      // TODO: handle exception
      System.out.println("AQUI*********************************************** "+e.getMessage());
      e.printStackTrace();
      }

      }

      /**
      * @param columnas the columnas to set
      */
      public void setColumnas(ListDataModel columnas) {
      this.columnas = columnas;
      }

      /**
      * @return the columnas
      */
      public ListDataModel getColumnas() {
      return columnas;
      }




      }