3 Replies Latest reply on Oct 12, 2007 12:02 PM by francisco.noguera

    Problems with <t:dataList>

    francisco.noguera

      this is my source code

      xhtml:
      --------------------
      <t:dataList var="marcador" value="#{EnlazarProveedor.marcadores}" layout="simple" rowCountVar="rowCount"
      rowIndexVar="rowIndex"
      preserveDataModel="false">

      <h6>
      <a href="#{marcador.url}url='javascript:EscribirValor()'" id="resultadoURL">
      <h:outputText value="#{marcador.titulo}"/>

      </h6>

      </t:dataList>
      ----------------------
      java Facade:

      @Stateless
      public class SitiosWebFacade extends ReelFacade implements ISitiosWebFacade {

      public List listarMarcadores() {
      String consulta = "SELECT a FROM Marcador a";
      return getEm().createQuery(consulta).getResultList();
      }

      public Marcador guardarMarcador(Marcador marcador) {

      if (marcador != null) {
      if (marcador.getId() == 0)
      getEm().persist(marcador);
      else
      marcador = getEm().merge(marcador);
      }
      return marcador;
      }
      }

      -------------------------------------------------

      java action:

      public class EnlazarProveedorMarcadoresAction extends SitiosWebBaseAction implements IEnlazarProveedorMarcadoresAction {

      private String cid;
      private String arreglo[ ];
      private String nombre;
      private String parametro2;


      /** Creates a new instance of EnlazarProveedorMarcadoresAction */
      public EnlazarProveedorMarcadoresAction() {

      }


      private void validateCid() {
      cid = Conversation.instance().getId();
      }


      @Destroy @Remove
      public void remove() {

      }

      public void iniciar() {
      log.info("Inicia el componente SEAM {0}",new Date());
      validateCid();
      log.info("CID-INICIO: '#0'",cid);
      listarMarcadores();
      }

      public void listarMarcadores(){
      marcadores = sitiosWebFacade.listarMarcadores();
      Iterator it = marcadores.iterator();
      while(it.hasNext()) {
      Marcador m = (Marcador)it.next();
      System.out.println(m.getTitulo());
      }
      }
      }

      ----------------
      The problem is that the dataList component only return me the first value, but the dataTable return me all the values in my DB table. I don't know which is the mistake, but I really need the help. Thanks for the answers...

        • 1. Re: Problems with <t:dataList>
          pmuir

          Use [ code ] tags please.

          I don't see where you make #{EnlazarProveedor.marcadores} available in your seam components.

          • 2. Re: Problems with <t:dataList>
            francisco.noguera

            @Stateful
            public abstract class SitiosWebBaseAction extends ReelAction implements ISitiosWebBaseAction {

            @Logger
            protected Log log;

            @EJB
            protected ISitiosWebFacade sitiosWebFacade;

            @In("facesMessages")
            protected FacesMessages msg;

            @DataModelSelection("marcadores")
            @Out(value="marcador",required=false)
            protected Marcador marcador;

            @DataModelSelection("documentos")
            @Out(value="documento",required=false)
            protected Documento documento;

            @DataModelSelection("noticias")
            @Out(value="noticia",required=false)
            protected Noticia noticia;

            @DataModel
            protected List marcadores;

            /** Creates a new instance of SitiosWebBaseAction */
            public SitiosWebBaseAction() {
            }


            @Create
            public void create() {
            sesion = Contexts.getSessionContext();
            iniciar();
            }

            public Marcador getMarcador() {
            return marcador;
            }

            public void setMarcador(Marcador marcador) {
            this.marcador = marcador;
            }

            public List getMarcadores() {
            return marcadores;
            }

            public void setMarcadores(List marcadores) {
            this.marcadores = marcadores;
            }
            }
            ----------------------------------------------
            srry this is the another part

            • 3. Re: Problems with <t:dataList>
              francisco.noguera

              ty for the answers my problem was for tomahawk configuration. To evoid this problems use this configuration paper:

              http://demetrio812.blogspot.com/2007/08/install-tomahawk-in-seam-gen-generated.html

              :)...