8 Replies Latest reply on May 26, 2008 2:07 PM by wesleyhales

    Duplicate Id exception for a a4j:commandLink

    antoine_h

      Hi,

      I have noticed a problem with the commandLink.
      I solved it, but would like to help debug this ... or to set some documentation to avoid the problem later...

      may be create a Jira later ?
      is it a Bridge problem, or a RichFaces problem ?

      the problem is similar to the one in this Jira :
      http://jira.jboss.com/jira/browse/RF-1964

      I use a commandLink in a table.
      In a regular JSF RichFaces file.
      The commandLink call a view that is in a kind of "template file". A file that include another "sub file" for the detail of the content.
      The table is in the "sub file", that is included (<ui:include ...) in the "template file".

      when I click on the commandLink : it is not working : the page comes again, but with no change.
      If I try then to refresh the page : sometimes it goes to the result page, most of the times it throws an exception of Duplicate Id, etc...
      In the code, the id is defined, and not duplicated.

      this problem is on several forum post. It is not really a problem of the Id written in the code.

      ************
      I had solved the problem, by struggling with the config, the way to write the code ... well it was working. no more error.

      I worked on many other thing, ... the commandLink worked fine.

      Once, I changed many things in my code, ... I don't remember all that I changed, nor where... but the exception was thrown again !

      *************
      solution :
      struggling again... I solved it finally, with just replacing the commandLink with a commandButton :

      It was :

      <a4j:commandLink
       action="#{dataRefMngtBKBMain.viewStandardDtRefTable}">
       <h:outputText value="View the records" />
       <f:param name="actNav" value="viewStd_DTRefTable" />
       <f:param name="currentEntityClass" value="#{varItem_main.name}" />
       </a4j:commandLink>
      


      it is now :
      <a4j:commandButton value="View the records"
       action="#{dataRefMngtBKBMain.viewStandardDtRefTable}">
       <f:param name="actNav" value="viewStd_DTRefTable" />
       <f:param name="currentEntityClass" value="#{varItem_main.name}" />
       </a4j:commandButton>
      


      **********
      It now works perfectly again.

      I noticed also that the response is executed much faster.
      I had some delay in the response : now, it is instant response of the server...

      *********
      so :
      I don't know if it worth open a jira on that.
      where to open it ?

      or is there an explaination why the "quite same code" of a commandLink does not work, and with a commandButton it works ?

      Thanks,


        • 1. Re: Duplicate Id exception for a a4j:commandLink
          antoine_h

          Another things :
          - when there was the problem, I often could see some compenents rendered twice in the result page ....
          - it is really much more quick with the commandButton than with the commandLink

          => I think it is really a problem with the Id of the components in the jsf tree.

          with the commandButton, it seems to be managed differently (at least for provided it's id, or things like that) : so there is no more duplication. And so it
          is much faster when processing the tree.

          some duplicated components sometimes comes up to the html page and are visible ...
          This happens when the whole rendering did not failed with the :
          IllegalStateException: duplicate Id for a component.... exception thrown.

          so it seems to be a question of Id, and include of files, and commandLink in table columns.

          • 2. Re: Duplicate Id exception for a a4j:commandLink
            wesleyhales

            Can you try to see if this problem happens outside of the bridge/portlet environment?
            If it only happens while running in the bridge/portal, can you create a Jira issue and attach some code/project so we can easily repeat the problem?

            • 3. Re: Duplicate Id exception for a a4j:commandLink
              antoine_h

              hi,

              yes ! that's a good idea !

              I did not think of it because my code will need the portal environnement...
              but in fact, may be it will work...

              I'll give a try right now and will see if possible....

              • 4. Re: Duplicate Id exception for a a4j:commandLink
                antoine_h

                I can't get the application run without the portlet and portal environment.

                I will let this aside for a while and try again later : having a way to test thing without the portlet bridge will be usefull,... several times in the future...

                • 5. Re: Duplicate Id exception for a a4j:commandLink
                  wesleyhales

                  I just added some code (thanks Muhammad) that fixes the bug that is supposed to allow you to run your application in parallel with the portlet one.

                  If you build trunk from src, you can access the app without making any changes by using the servlet context.

                  • 6. Re: Duplicate Id exception for a a4j:commandLink
                    antoine_h

                    thanks
                    that sound good.

                    I will try it... but later : I have to rush on what I was doing yet...

                    About my question : I think (intuitively) that there is only 5% chance that the problem is related to the use of the portlet bridge.
                    and 95% that is on RichFaces side.
                    This because this problem of commandLinks that does not work when it is in a DataTable and in a included file.... have been seen on other forum... with no portal at all....
                    even if it is not exactly the same problem.

                    Well, it is worth to look at it any way : the "commandLinks that does not work when it is in a DataTable and in a included file.... "

                    • 7. Re: Duplicate Id exception for a a4j:commandLink
                      antoine_h

                      When you say : "allow you to run your application in parallel..."
                      how ?

                      you call the Url of the webapp directly ?

                      with Url : myHost/_MyWarName/myPathToJsfFiles/myJsfFile.xhtml

                      is that correct ?

                      • 8. Re: Duplicate Id exception for a a4j:commandLink
                        wesleyhales

                        yep, you got it.