8 Replies Latest reply on Nov 10, 2008 5:54 AM by ilya_shaikovsky

    Duplicate ID using rich:dataTable

    ceduardo.roque

      Hi everybody,

      I'm having an issue regarding rich:dataTable and a rich:datascroller. The problem seems simple, but I'm not understanding what's going on.

      When I enter the main page of my application (that has four text fields and two buttons, one dataTable and one dataScroller), everything works fine.

      But if I press F5 or browser's refresh button, JSF seems to break down, throwing a duplicate ID exception (see below).

      javax.servlet.ServletException: duplicate Id for a component j_id5:tabela:j_id16
       javax.faces.webapp.FacesServlet.service(FacesServlet.java:256)
       org.apache.myfaces.webapp.filter.ExtensionsFilter.doFilter(ExtensionsFilter.java:246)
       org.ajax4jsf.webapp.BaseXMLFilter.doXmlFilter(BaseXMLFilter.java:154)
       org.ajax4jsf.webapp.BaseFilter.handleRequest(BaseFilter.java:260)
       org.ajax4jsf.webapp.BaseFilter.processUploadsAndHandleRequest(BaseFilter.java:366)
       org.ajax4jsf.webapp.BaseFilter.doFilter(BaseFilter.java:493)
       org.apache.myfaces.webapp.filter.ExtensionsFilter.doFilter(ExtensionsFilter.java:301)
       org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(ReplyHeaderFilter.java:96)
      


      In my case, my dataTable's got an id called "tabela", that is referenced by the datascroller.

      Has anybody had this problem?

      Appreciate your answer.

      Best Regards,

      ceduardo.roque

        • 1. Re: Duplicate ID using rich:dataTable
          rahul_maha

          Just make sure your all components on page has IDs.

          Including a4jsupport, a4jregion etc.

          Also if you are using viewsource than you can search for the reported id on page source (error page of facelets in development mode).

          Also try the latest Majorra build of 1.2.9.

          • 2. Re: Duplicate ID using rich:dataTable
            ceduardo.roque

             

            "rahul_maha" wrote:
            Just make sure your all components on page has IDs.

            Including a4jsupport, a4jregion etc.

            Also if you are using viewsource than you can search for the reported id on page source (error page of facelets in development mode).

            Also try the latest Majorra build of 1.2.9.


            Hi Rahul_Maha,

            Thank you for your reply.
            I'll check my code over to see if every component's got an id. But, can you tell me, if my dataTable has an Id, why JSF considers that it's got a duplicate one?

            It seems that it is trying to recreate the component in the session, even if it is already there.

            I was wondering if couldn't it be something with my managed bean's session scope.

            thank you!

            ceduardo.roque

            • 3. Re: Duplicate ID using rich:dataTable
              ceduardo.roque

               

              "rahul_maha" wrote:
              Just make sure your all components on page has IDs.

              Including a4jsupport, a4jregion etc.

              Also if you are using viewsource than you can search for the reported id on page source (error page of facelets in development mode).

              Also try the latest Majorra build of 1.2.9.


              Hi Rahul_Maha,

              Thank you for your reply.
              I'll check my code over to see if every component's got an id. But, can you tell me, if my dataTable has an Id, why JSF considers that it's got a duplicate one?

              It seems that it is trying to recreate the component in the session, even if it is already there.

              I was wondering if couldn't it be something with my managed bean's session scope.

              thank you!

              ceduardo.roque

              • 4. Re: Duplicate ID using rich:dataTable
                ceduardo.roque

                 

                "rahul_maha" wrote:
                Just make sure your all components on page has IDs.

                Including a4jsupport, a4jregion etc.

                Also if you are using viewsource than you can search for the reported id on page source (error page of facelets in development mode).

                Also try the latest Majorra build of 1.2.9.


                Hi Rahul_Maha,

                Thank you for your reply.
                I'll check my code over to see if every component's got an id. But, can you tell me, if my dataTable has an Id, why JSF considers that it's got a duplicate one?

                It seems that it is trying to recreate the component in the session, even if it is already there.

                I was wondering if couldn't it be something with my managed bean's session scope.

                thank you!

                ceduardo.roque

                • 5. Re: Duplicate ID using rich:dataTable
                  maxmustang

                  Hi,
                  Give it a try and make e redirect tag in facelet-config inside the navigation-case.
                  This allows presing F5 not to send data twice.
                  I did it in all my navigation-cases, so users can press F5 whereever they like without strange behavour, as side-efect you then see allways the right URL and not page-name of the previous page.
                  Example:

                  <navigation-case>
                  <from-outcome>selectGroup</from-outcome>
                  <to-view-id>/modules/system/groups/findGroup.seam</to-view-id>

                  </navigation-case>

                  • 6. Re: Duplicate ID using rich:dataTable
                    maxmustang

                    sorry, in preview seen redirect tag strange but in post the line is empty got lost, ... have a look in google for "facelet-config navigation-case redirect"

                    • 7. Re: Duplicate ID using rich:dataTable
                      jonmoores

                      Dont know if it helps but I have had a similar issue.

                      I tracked it down to using a normal HTML element in the JSF page

                      Thanks
                      Jon

                      • 8. Re: Duplicate ID using rich:dataTable
                        ilya_shaikovsky

                        duplicate Ids problem could rise if you use binding to session scoped beans. And this problem occurs without RF in your application also.