2 Replies Latest reply on Dec 10, 2012 4:21 AM by marcelbihr

    Duplicate ID exception in extendedDataTable with PARTIAL_STATE_SAVING set to false

    marcelbihr

      I played around with the extendedDataTable to find out whether it suits our needs. However I always get 'JSF1007: Doppelte Komponenten-ID topform:artefactTable:j_idt5 in Ansicht gefunden.' [which means duplicate component id found...] on postbacks (either via action button or also on sroll). When I set javax.faces.PARTIAL_STATE_SAVING to true, it works fine, when set to false the exception happens. The duplicate id happens on the column in the table. Assigning the column an id does not make any difference.

       

      The bean providing the DataModel is Request-Scoped, but the exception also happens when I set it to SessionScoped.

       

      In our project we need to set partial-state-saving to false in order for the viewscope (used otherwise heavily) to work correctly, just enabling parital-state-saving is thus not an option.

       

      Facelet Code:

       

      <?xml version="1.0" encoding="UTF-8"?>

      <!DOCTYPE html

              PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"

              "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

      <html xmlns="http://www.w3.org/1999/xhtml"

          xmlns:f="http://java.sun.com/jsf/core"

          xmlns:h="http://java.sun.com/jsf/html"

          xmlns:ui="http://java.sun.com/jsf/facelets"

          xmlns:a4j="http://richfaces.org/a4j"

          xmlns:rich="http://richfaces.org/rich">

       

      <h:head>

       

      </h:head>

       

      <h:body>

       

      <h:form id="topform">

       

          <h:panelGroup id="fulltext" layout="block">

              <h:inputText autocomplete="on" placeholder="Suche" value="#{tableBean.search}" id="fulltextSearchBox">

                  <f:ajax event="change" render="topform:artefactTable"/>

              </h:inputText>

              <h:commandButton value="Suchen">

                  <f:ajax event="click" render="topform:artefactTable"/>

              </h:commandButton>

          </h:panelGroup>

       

          <rich:extendedDataTable id="artefactTable" style="height:200px; width:300px;" clientRows="20" value="#{tableBean.tableModel}" var="artefact" >

             <rich:column >

                 <f:facet name="header">

                    <h:outputText value="Name" />

                </f:facet>

                #{artefact.salutation.label} #{artefact.lastname}, #{artefact.firstname}

            </rich:column>

            <rich:column>

                <f:facet name="header">

                    <h:outputText value="Firma" />

                </f:facet>

                #{personsBean.getOrganisationInfo(artefact)}

            </rich:column>

         </rich:extendedDataTable>

      </h:form>

      </h:body>

       

      </html>

       

       

      Any hints what the problem or a potential solution could be?

       

      Regards

       

      Marcel

        • 1. Re: Duplicate ID exception in extendedDataTable with PARTIAL_STATE_SAVING set to false
          healeyb

          I vaguely recollect trying full state saving and having problems also, so I wonder if it might be the case that only partial state saving is supported.

          At risk of going off wildly on a tangent, on a positive note I would suggest checking out the custom scopes available in Myfaces CODI

          https://cwiki.apache.org/confluence/display/EXTCDI/Documentation.

           

          In particular the @ViewAccessScoped scope which is @ViewScoped done properly. Basically the contract is that a bean goes out of

          scope when the first page loads which doesn't use it. Nice and easy to understand. This is built on top of CDI so you would need to migrate

          from @ManagedBean to use this, but there are a lot of good things about CDI that you can then investigate. One of the drawbacks with CDI

          has been that it didn't come with a view scope out of the box, and this is one of the things that both CODI and Seam have addressed.

           

          I'll give you a use case of mine with @ViewAccessScoped. The previous situation was that I had thousands of stupid view parameters to

          pass information from view to view. i.e. You have a table of employees, click on a row representing an employee and move to a detail page

          for that employee. The employee id would be passed as a view param between when the client requests the detail page. Bearing in mind that

          you're passing information between views in the same application in the same JVM it's annoying and insecure to have the employee id moving

          between the client and server.

           

          With the backing beans for the initial and detail pages as @ViewAccessScoped when the user clicks the row for the employee I just dynamically

          inject the detail page backing bean into the initial page backing bean and set the target employee id, so that when the page loads it knows

          which employee to show information about (the bean is put in scope by the dynamic injection before the page loads).

           

          Regards,

          Brendan.

          • 2. Re: Duplicate ID exception in extendedDataTable with PARTIAL_STATE_SAVING set to false
            marcelbihr

            Thank you for the suggestion, Brendan. For the moment, this is too much of a change, especially as the ViewScope is for us just the right scope.

            Reading through other discussions, I also get the impression that rf is not really non-partial-state ready (or even not intended).

             

            Regards

             

            Marcel