3 Replies Latest reply on Apr 27, 2012 6:24 AM by yashyadav

    duplicate id of element inside facet when using ui:include

    danielsap

      Hi,

      I'm writting an application with JDK7, Tomcat 7, MyFaces 2.1.2 Richfaces 4.1 M1

       

      I get this exception from jsf

           throw new IllegalStateException ("component with duplicate id \"" + id + "\" found");

          

      It happens only for element that is in <facet> tag, only when this facet is in rich:extendedDataTable.

      This rich:extendedDataTable resides in separate composition EventPanel.xhtml

      This EventsPanel.xhtml in another xhtml like this - <ui:include src="EventsPanel.xhtml" />

      It happens when I click <aj4:commandButton> and it renderes the view.

       

      I attached the web.xml and xhtml files

       

      Please, help me !

       

      Here is my research:

      When I click the commandButton

      FacletServlet.services the request

      It creates a UIPanel for the facet. Because this is how jsf 2 works.

      And put the the outputText (that is in the facet) in this UIPanel.(jsf uipanel, not richfaces one)

      and it puts the same outputText every time I click the commandButton. Without removing it. So, same outputText appears many time in this UIPanel.

       

      in org.apache.myfaces.view.facelets.tag.jsf.ComponentSupport is the method that do this - addFacet

        • 1. Re: duplicate id of element inside facet when using ui:include
          danielsap

          I continued the research:

           

          It seems that I can't have

                <rich:extendedDataTable binding="sessionBean.uiExtendedDataTable"...

           

          cause

          1-  The ComponentTagHandlerDelegate.apply() that creates the UIExtendedDataTable takes it from the sessionBean.uiExtendedDataTable

               But the taken uiExtendedDataTable is filled with all the columns and the facet

          2- After that it creates new ouputText that is in the facelet. It doesn't take the already existing one in the uiExtendedDataTable.

          3- It wants to put the newly created ouputText in the facet. But it finds the same ouputText there previously puted there.

              So it creates a new UIPanel and put both outputTexts in it.

          4- Finally it tries to remove the first ouputText but it is not there, its moved.

           

          So, I see now what is the problem about. Still don't know how to act! Will be thankfull for any advice or opinion!

          • 2. Re: duplicate id of element inside facet when using ui:include
            danielsap

            I replaced the Myfaces 2.1.2 implementation with Mojara 2.1.2 and everything works fine!

            Myfaces need to figure out this bug!

            • 3. Re: duplicate id of element inside facet when using ui:include
              yashyadav

              Hi Daniel,

               

              I am also facing the same issue with Tomcat 7, MyFaces 2.1.5 Richfaces 4.1.0 final.

              I also felt that its because of ui:include and the way MyFaces is handling this. But i was not able to find exact reason or point of issue for this.

               

              As you told, on replacing MyFaces with Mojara 2.1.7 did the magic and its working fine

               

              Thanks for the info.

               

              Regards,

              Yash