5 Replies Latest reply on Aug 6, 2008 4:02 PM by bek816

    AjaxStateManager duplicate Id for a component exception

    bek816

      I've posted this on the user forum, but I need to talk to someone technical. I also posted it on the Ajax developers forum, but it appears to be dead. I've been having a problem with the ids generated in the data table. See post below:

      I did some additional research and found some interesting results. I put a breakpoint in the AjaxStateManager around this section of code:

      String clientId = component.getClientId(context);
      if (!uniqueIds.add(clientId)) {
       throw new IllegalStateException("duplicate Id for a component "+ clientId);
      }


      I made the breakpoint conditional to only stop for the duplicate id. The ids of the duplicates were:

      body:form:tab:table:component id

      in both cases, the component was output text and the id was "_idJsp317".

      Here's the interesting part: not that the column was missing. When I inspected the component's parent through the debugger, it had an id of:

      body:form:tab:table:component id. (this was expected)

      In both cases, the component's parent (the column) had a unique id. So why isn't parent id being included along with the child? For example, for a component in a data table column, I would expect an id of:

      body:form:tab:table:column:component id but the ids that are generated are body:form:tab:table:component id (thus resulting in a duplicate id).

      Question: prior to migrating to rich races, we used A4J. How come we never encountered this problem before? Is this a case of rich faces having more stringent id checking? Or is rich faces doing something to generate the ids? Note that it is a tomahawk (1.1.4) data table.

      Thanks.

        • 1. Re: AjaxStateManager duplicate Id for a component exception
          bek816

          Hello?

          • 2. Re: AjaxStateManager duplicate Id for a component exception
            bek816

            Can someone explain to me what the AjaxStateManager in the 3.1.x branch is doing and why it is generating all sorts of duplicate id exceptions? I looked at the old ajax4jsf code and there was no AjaxStateManager class (it didn't exist). I looked at the latest 3.2.x code and the "apply" method that throws the exception is gone. In fact the class was totally revamped.

            • 3. Re: AjaxStateManager duplicate Id for a component exception
              alexsmirnov

              This code is a JSR requirements. In the old versions we didn't use own StateManager implementations, but this code exist in the any default implementations too.
              Also, what version of the JSF you are use ? In the latest releases, some workarounds for a SUN RI prior to 1.1_02 and MyFaces prior to 1.1.4 have been removed.
              Also, it was a bug in the facelets implementations for a <f:facet> tag. Try to set exact id's for an all "header" and "footer" components.

              • 4. Re: AjaxStateManager duplicate Id for a component exception
                bek816

                Thanks for the reply - incidentally I discovered the same workaround you suggested below. This however came after a week of effort. So if I have something like this:

                <t:column id="columnId">
                 <f:facet name="header">
                 <h:outputText value='something' id="columnHeaderId" />
                 </f:facet>
                 <h:outputText value="#{step.assignedDtm}" id="columnOutputId"/>
                </t:column>
                


                Which ids are needed? I've gotten it to work by putting ids in all the places above. Are you suggesting that ids are only needed on the output text inside the facet?

                We are using MyFaces 1.1.4 (snapshot), Tomahawk 1.1.2, and RichFaces 3.1.4.

                • 5. Re: AjaxStateManager duplicate Id for a component exception
                  bek816

                   

                  Also, what version of the JSF you are use ? In the latest releases, some workarounds for a SUN RI prior to 1.1_02 and MyFaces prior to 1.1.4 have been removed.


                  In the latest releases of what? RichFaces or MyFaces? Are you suggesting that if we go back to MyFaces 1.1.3 there's a workaround there?