4 Replies Latest reply on Feb 9, 2009 7:18 PM by Jon Zuccaro

    DataList component causes duplicate id inside repeat

    Jon Zuccaro Newbie

      If I place a DataList component inside an a4j:repeat the pages throws a Duplicate id exception after the second refresh, even if the component has rendered=false.

      I have explicit ids for all components, and I narrowed the problem to the Datalist, if I remove it from the page all works.

      I have also tried to replace DataList with another repeat and ul and li tags to no avail.

      Is this expected behavior?

        • 1. Re: DataList component causes duplicate id inside repeat
          Nick Belaevski Master

          No. Please provide full page code.

          • 2. Re: DataList component causes duplicate id inside repeat
            Jon Zuccaro Newbie

            There you go

            
            <%@ 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">
            <%@ taglib uri="http://java.sun.com/jsf/core" prefix="f"%>
            <%@ taglib uri="http://java.sun.com/jsf/html" prefix="h"%>
            <!-- RichFaces tag library declaration -->
            <%@ taglib uri="http://richfaces.org/a4j" prefix="a4j"%>
            <%@ taglib uri="http://richfaces.org/rich" prefix="rich"%>
            <html>
            <head>
            <link rel="alternate" media="print" href="print.ent" title="leo" />
            <link rel="stylesheet" type="text/css"
             href="/SantaInesFase1/recursos/estilos/estilo.css" />
            <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
            <title></title>
            </head>
            <body>
            <f:view>
             <f:loadBundle basename="#{facesContext.application.messageBundle}"
             var="etiquetas" />
             <h:form id="form1">
             <a4j:repeat binding="#{indexInformacion.areas}"
             value="#{informacionDetalles.areas}" var="area">
             <a4j:outputPanel layout="block" id="contenedorMenu"
             styleClass="menuDefault">
             <a4j:outputPanel layout="block" styleClass="contentMenu"
             id="contenidoMenu">
             <a4j:outputPanel styleClass="containerSubMenu2" layout="block"
             id="contenedorProcedimientos">
             <a4j:outputPanel styleClass="containerDetails" layout="block"
             id="contenedorDetallesProcedimiento">
             <rich:panel styleClass="panelProcedimientos"
             headerClass="panelProcedimientosHeader"
             id="detallesProcedimiento">
             <f:facet name="header">
             <h:outputText
             value="#{informacionDetalles.procedimiento.idAdministrativo} #{informacionDetalles.procedimiento.nombre}"></h:outputText>
             </f:facet>
             <h:outputText
             value="#{informacionDetalles.procedimiento.descripcion}"></h:outputText>
             <rich:dataList var="indicacion" id="indicaciones"
             value="#{informacionDetalles.procedimiento.indicaciones}">
             <h:outputText value="#{indicacion.nombre}" />
             <br />
             <h:outputText value="#{indicacion.descripcion}" />
             </rich:dataList>
             </rich:panel>
             </a4j:outputPanel>
             </a4j:outputPanel>
             </a4j:outputPanel>
             </a4j:outputPanel>
             </a4j:repeat>
             </h:form>
            </f:view>
            </body>
            </html>


            Error:

            
            
            javax.servlet.ServletException: duplicate Id for a component form1:j_id_jsp_824078984_12:indicaciones:j_id0
             javax.faces.webapp.FacesServlet.service(FacesServlet.java:256)
             org.ajax4jsf.webapp.BaseXMLFilter.doXmlFilter(BaseXMLFilter.java:177)
             org.ajax4jsf.webapp.BaseFilter.handleRequest(BaseFilter.java:267)
             org.ajax4jsf.webapp.BaseFilter.processUploadsAndHandleRequest(BaseFilter.java:380)
             org.ajax4jsf.webapp.BaseFilter.doFilter(BaseFilter.java:507)
             org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(ReplyHeaderFilter.java:96)
            



            informacionDetalles scope = session
            JBOSS 4.2.3
            Windows XP

            • 3. Re: DataList component causes duplicate id inside repeat
              Nick Belaevski Master

              Hi,

              I see no problems running the code, so I think session binding for a4j:repeat is the reason.

              • 4. Re: DataList component causes duplicate id inside repeat
                Jon Zuccaro Newbie

                Hi nbelaevski!

                You are right, indexInformacion (where I have the repeat component) was registered with session scope, Changing it to request solved my problem

                Thank you!