4 Replies Latest reply on Jul 22, 2009 1:06 PM by ilya_shaikovsky

    Frustrating problem with ids (I think)

    cmathrusse

      RichFaces 3.3.1-GA

      I've got two search pages that seem to be colliding. One is an Address search page and the other is an order search page. If I log into my application and go to the Address Search page, everything works perfect. However, if I log into the app and go to the Order Search page first, perform a search (which works correctly) and then go to my address search page and perform a search, the result page is incorrect. Looking at the source of the page it appears that it is pulling in the components from the Order Search page, and I can't figure out why.

      The same happens in reverse as well. When I start with the Address search, perform a search and then go to the Order search page and perform a search, my results are incorrect here as well.

      I've triple checked all my component Id's on each page to ensure there are no collisions but I can't seem to find any issue. I've also ensured that my variable names are not the same on both pages but that seems to have no effect as well. When the issue arises on the Address Search page and the results are askew, I repeat my search and receive the following error:

      duplicate Id for a component j_id60:addressesReportDataTable:j_id118


      Any help would be greatly appreciated. I've places the html files out on a share:
      The bad one.
      http://files.getdropbox.com/u/601181/faces_ID_ISSUE/addresses_bad.html

      And the good one:
      http://files.getdropbox.com/u/601181/faces_ID_ISSUE/addresses_good.html

      Thanks for the help...


        • 1. Re: Frustrating problem with ids (I think)
          kragoth

          Can you please post your actual xhtml code. The html is basically useless.
          Just copy and paste it into your post and surround it with [ code ] tags (without the spaces obviously)

          • 2. Re: Frustrating problem with ids (I think)
            ilya_shaikovsky

            the problem could be in session scoped bindings usage.

            • 3. Re: Frustrating problem with ids (I think)
              cmathrusse

              Here is the addresses.xhtml

              <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
               "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
              <ui:composition xmlns="http://www.w3.org/1999/xhtml"
               xmlns:ui="http://java.sun.com/jsf/facelets"
               xmlns:h="http://java.sun.com/jsf/html"
               xmlns:f="http://java.sun.com/jsf/core"
               xmlns:a4j="http://richfaces.org/a4j"
               xmlns:rich="http://richfaces.org/rich"
               template="../layout/layout.xhtml">
              
               <ui:param name="pageTitle" value="#{msgs.rtpAddressSearchTitle}" />
               <ui:param name="printPage" value="/address/addressesPrintable.jsf" />
               <ui:param name="printDisabled" value="#{empty address.records}" />
              
               <ui:define name="main-frame">
               <h:form>
               <h:panelGrid id="addressesPanel1" width="125%">
               <h:panelGrid columns="16">
               <label for="addressesExternalId">#{msgs.rptHdrExtId}:</label>
               <h:inputText id="addressesExternalId" size="12"
               value="#{address.searchAddress.externalId}" />
              
               <rich:spacer width="10%" height="10" />
              
               <label for="addressesAddressName">#{msgs.rptHdrName}:</label>
               <h:inputText id="addressesAddressName" size="12"
               value="#{address.searchAddress.name}" />
              
               <rich:spacer width="10%" height="10" />
              
               <h:outputLabel for="addressesOrganizationList" value="#{msgs.orgsTitle}:" />
               <h:selectOneMenu id="addressesOrganizationList" value="#{address.searchAddress.organization}"
               converter="organizationConverter">
               <f:selectItems value="#{address.allOrganizations}"/>
               </h:selectOneMenu>
              
               <rich:spacer width="10%" height="10" />
              
               <h:outputLabel for="addressesCountryList" value="#{msgs.countriesTitle}:" />
               <h:selectOneMenu id="addressesCountryList" value="#{address.searchAddress.country}"
               converter="countryConverter">
               <f:selectItems value="#{address.allCountries}"/>
               </h:selectOneMenu>
              
               <rich:spacer width="10%" height="10" />
              
               <h:outputLabel for="addressesAddressStateList" value="#{msgs.rptState}:" />
               <h:selectOneMenu id="addressesAddressStateList" value="#{address.searchAddress.addressState}"
               converter="addressStateConverter">
               <f:selectItems value="#{address.allAddressStates}"/>
               </h:selectOneMenu>
              
               <rich:spacer width="10%" height="10" />
              
               <rich:spacer width="20%" height="10" />
               <a4j:commandButton id="addressesButtonSearch" type="button" value="#{msgs.buttonSearch}"
               action="#{address.searchAction}"/>
               </h:panelGrid>
               <rich:spacer height="10" />
              
               <rich:dataTable value="#{address.records}" var="rptAddress" id="addressesReportDataTable"
               onRowMouseOver="this.style.backgroundColor='#F1F1F1';this.style.cursor='pointer'"
               onRowMouseOut="this.style.backgroundColor='#{a4jSkin.tableBackgroundColor}'"
               cellpadding="0" cellspacing="0" border="0" rows="#{layout.user.rowsPerPage}" reRender="addressesReportDataTableDs"
               rendered="#{not empty address.records}"
               style="width: 100%; table-layout: fixed;"
               binding="#{addressDetail.table}">
              
               <a4j:support id="addressesRowClickAction" event="onRowClick" action="#{addressDetail.selectAction}">
               <a4j:actionparam name="addressDetailReturnPage" value="address" assignTo="#{addressDetail.returnPage}"/>
               </a4j:support>
              
               <f:facet name="header">
               <rich:columnGroup>
               <rich:column colspan="8">
               <h:outputText value="#{msgs.rptDailyTitle}" />
               </rich:column>
               </rich:columnGroup>
               </f:facet>
              
               <rich:column style="text-align: center"
               filterBy="#{rptAddress.externalId}" filterEvent="onkeyup"
               sortBy="#{rptAddress.externalId}">
               <f:facet name="header">
               <h:outputText value="#{msgs.rptHdrExtId}"/>
               </f:facet>
               <h:outputText value="#{rptAddress.externalId}" />
               </rich:column>
              
              
               <rich:column style="text-align: center"
               filterBy="#{rptAddress.name}" filterEvent="onkeyup"
               sortBy="#{rptAddress.name}">
               <f:facet name="header">
               <h:outputText value="#{msgs.rptHdrName}"/>
               </f:facet>
               <h:outputText value="#{rptAddress.name}" />
               </rich:column>
              
               <rich:column style="text-align: center"
               filterBy="#{rptAddress.address1}" filterEvent="onkeyup"
               sortBy="#{rptAddress.address1}">
               <f:facet name="header">
               <h:outputText value="#{msgs.address1}"/>
               </f:facet>
               <h:outputText value="#{rptAddress.address1}" />
               </rich:column>
              
               <rich:column style="text-align: center"
               filterBy="#{rptAddress.city}" filterEvent="onkeyup"
               sortBy="#{rptAddress.city}">
               <f:facet name="header">
               <h:outputText value="#{msgs.addressCity}"/>
               </f:facet>
               <h:outputText value="#{rptAddress.city}" />
               </rich:column>
              
               <rich:column style="text-align: center"
               filterBy="#{rptAddress.regionCode}" filterEvent="onkeyup"
               sortBy="#{rptAddress.regionCode}">
               <f:facet name="header">
               <h:outputText value="#{msgs.addressRegion}"/>
               </f:facet>
               <h:outputText value="#{rptAddress.regionCode}" />
               </rich:column>
              
               <rich:column style="text-align: center"
               filterBy="#{rptAddress.country}" filterEvent="onkeyup"
               sortBy="#{rptAddress.country}">
               <f:facet name="header">
               <h:outputText value="#{msgs.addressCountry}"/>
               </f:facet>
               <h:outputText value="#{rptAddress.country}" />
               </rich:column>
              
               <rich:column style="text-align: center"
               filterBy="#{rptAddress.organization.id}" filterEvent="onkeyup"
               sortBy="#{rptAddress.organization.id}">
               <f:facet name="header">
               <h:outputText value="#{msgs.rptHdrOrg}"/>
               </f:facet>
               <h:outputText value="#{rptAddress.organization.id}" />
               </rich:column>
              
               <rich:column style="text-align: center"
               filterBy="#{rptAddress.addressState.id}" filterEvent="onkeyup"
               sortBy="#{rptAddress.addressState.id}">
               <f:facet name="header">
               <h:outputText value="#{msgs.processState}"/>
               </f:facet>
               <h:outputText value="#{rptAddress.addressState.id}" />
               </rich:column>
               <f:facet name="footer">
               <rich:datascroller id="addressesReportDataTableDs" for="addressesReportDataTable" maxPages="20" renderIfSinglePage="false"/>
               </f:facet>
               </rich:dataTable>
               </h:panelGrid>
               </h:form>
               </ui:define>
              
              </ui:composition>
              


              And here is the order report:
              <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
               "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
              <ui:composition xmlns="http://www.w3.org/1999/xhtml"
               xmlns:ui="http://java.sun.com/jsf/facelets"
               xmlns:h="http://java.sun.com/jsf/html"
               xmlns:f="http://java.sun.com/jsf/core"
               xmlns:a4j="http://richfaces.org/a4j"
               xmlns:rich="http://richfaces.org/rich"
               template="../layout/layout.xhtml">
              
               <ui:param name="pageTitle" value="#{msgs.rptOrderTransactionTitle}" />
               <ui:param name="printPage" value="/reports/totAddrSentPrintable.jsf" />
               <ui:param name="printDisabled" value="#{empty totalAddrReport.records}" />
              
               <ui:define name="main-frame">
               <h:form>
               <h:panelGrid>
               <h:panelGrid columns="13">
               <label for="calStartDate">#{msgs.rptStartDate}:</label>
               <rich:calendar name="Calendar" id="calStartDate"
               value="#{totalAddrReport.startDate}"
               timeZone="#{totalAddrReport.dateTimeZone}"
               datePattern="#{totalAddrReport.datePattern}">
               </rich:calendar>
              
               <rich:spacer width="10%" height="10" />
              
               <label for="calEndDate">#{msgs.rptEndDate}:</label>
               <rich:calendar name="Calendar" id="calEndDate"
               value="#{totalAddrReport.endDate}"
               timeZone="#{totalAddrReport.dateTimeZone}"
               datePattern="#{totalAddrReport.datePattern}">
               </rich:calendar>
              
               <rich:spacer width="10%" height="10" />
              
               <label for="orderTxOrderNo">#{msgs.rptOrderNo}:</label>
               <h:inputText id="orderTxOrderNo" value="#{totalAddrReport.orderNo}">
              
               </h:inputText>
              
               <rich:spacer width="10%" height="10" />
              
               <label for="orderTxOrganizationList">#{msgs.rptOrganization}:</label>
               <h:selectOneMenu id="orderTxOrganizationList" value="#{totalAddrReport.selectedOrgType}">
               <f:selectItems value="#{totalAddrReport.organizations}" />
               </h:selectOneMenu>
              
               <rich:spacer width="10%" height="10" />
               <a4j:commandButton id="orderTxButtonSearch" type="button" value="#{msgs.buttonSearch}"
               action="#{totalAddrReport.searchAction}"/>
              
               </h:panelGrid>
              
               <rich:spacer height="10" />
              
               <rich:dataTable value="#{totalAddrReport.records}" var="order" id="orderTxReportTable"
               onRowMouseOver="this.style.backgroundColor='#F1F1F1'"
               onRowMouseOut="this.style.backgroundColor='#{a4jSkin.tableBackgroundColor}'"
               cellpadding="0" cellspacing="0" border="0" style="width: 100%;"
               rows="2" reRender="orderTxReportTableDs"
               rendered="#{not empty totalAddrReport.records}">
              
               <f:facet name="header">
               <h:outputText value="#{msgs.rptOrderTransactionTitle}" />
               </f:facet>
               <rich:column style="font-weight: bold; text-align: center; border-right: none; background-color: #D8D8D8;" sortBy="#{order.orderNo}">
               <f:facet name="header">
               <h:outputText value="#{msgs.rptOrderNo}" />
               </f:facet>
               <h:outputText value="#{order.orderNo}" />
               </rich:column>
               <rich:column style="font-weight: bold; text-align: center; border-right: none; background-color: #D8D8D8;" sortBy="#{order.orderCode}" >
               <f:facet name="header">
               <h:outputText value="#{msgs.rptHdrOrderCode}" />
               </f:facet>
               <h:outputText value="#{order.orderCode}" />
               </rich:column>
               <rich:column style="font-weight: bold; text-align: center; border-right: none; background-color: #D8D8D8;" sortBy="#{order.releaseStatus}">
               <f:facet name="header">
               <h:outputText value="#{msgs.rptReleaseStatus}" />
               </f:facet>
               <h:outputText value="#{msgs.rptStatusReleased}" rendered="#{order.releaseStatus==true}"></h:outputText>
               <h:outputText value="#{msgs.rptStatusNotReleased}" rendered="#{order.releaseStatus==false}"></h:outputText>
               </rich:column>
               <rich:column style="font-weight: bold; text-align: center; border-right: none; background-color: #D8D8D8;" >
               <f:facet name="header">
               <h:outputText value="#{msgs.addressOrg}" />
               </f:facet>
               <h:outputText value="#{order.organization}" />
               </rich:column>
               <rich:column style="background-color: #D8D8D8;" >
               <f:facet name="header">
               <h:outputText value="#{msgs.rptHdrExtId}" />
               </f:facet>
               </rich:column>
               <rich:column style="background-color: #D8D8D8;" >
               <f:facet name="header">
               <h:outputText value="#{msgs.rptType}" />
               </f:facet>
               </rich:column>
               <rich:column style="background-color: #D8D8D8;" >
               <f:facet name="header">
               <h:outputText value="#{msgs.rptHdrName}" />
               </f:facet>
               </rich:column>
               <rich:column style="background-color: #D8D8D8;" >
               <f:facet name="header">
               <h:outputText value="#{msgs.rptAddress}" />
               </f:facet>
               </rich:column>
               <rich:column style="font-weight: bold; text-align: center; border-right: none; background-color: #D8D8D8;" >
               <f:facet name="header">
               <h:outputText value="#{msgs.rptStatus}" />
               </f:facet>
               <h:outputText value="#{order.state}" />
               </rich:column>
               <rich:column style="font-weight: bold; text-align: center; border-right: none; background-color: #D8D8D8;">
               <f:facet name="header">
               <h:outputText value="#{msgs.rptDateProcessed}" />
               </f:facet>
               <h:outputText value="#{order.createDate}" />
               </rich:column>
              
               <rich:subTable id="orderTxReportTableSubTable1"
               onRowMouseOver="this.style.backgroundColor='#F1F1F1';this.style.cursor='pointer'"
               onRowMouseOut="this.style.backgroundColor='#{a4jSkin.tableBackgroundColor}'"
               var="orderAddressRecord" value="#{order.addresses}"
               rendered="#{not empty order.addresses}"
               binding="#{addressDetail.table}">
              
               <a4j:support id="orderTxReportTableRowClickAction" event="onRowClick" action="#{addressDetail.selectAction}">
               <a4j:actionparam name="addressDetailReturnPage" value="orderAddresses" assignTo="#{addressDetail.returnPage}"/>
               </a4j:support>
              
               <rich:column colspan="3" style="border-right: none;">
               <rich:spacer />
               </rich:column>
               <rich:column style="text-align: center;" >
               <h:outputText value="#{orderAddressRecord.organization.id}" />
               </rich:column>
               <rich:column>
               <h:outputText value="#{orderAddressRecord.externalId}"></h:outputText>
               </rich:column>
               <rich:column>
               <h:outputText value="#{msgs.rptAddress}" rendered="#{orderAddressRecord.nameType=='ADDRESS_NAME'}"></h:outputText>
               <h:outputText value="#{msgs.rptContact}" rendered="#{orderAddressRecord.nameType=='CONTACT_NAME'}"></h:outputText>
               </rich:column>
               <rich:column>
               <h:outputText value="#{orderAddressRecord.name}"></h:outputText>
               </rich:column>
               <rich:column>
               <h:outputText value="#{orderAddressRecord.address1}, "/>
               <h:outputText rendered="#{not empty orderAddressRecord.address2}" value="#{orderAddressRecord.address2}, " />
               <h:outputText rendered="#{not empty orderAddressRecord.address3}" value="#{orderAddressRecord.address3}, " /><br/>
               <h:outputText rendered="#{orderAddressRecord.city != '-'}" value="#{orderAddressRecord.city}, "/>
               <h:outputText rendered="#{orderAddressRecord.regionCode != '-'}" value="#{orderAddressRecord.regionCode} "/>
               <h:outputText rendered="#{orderAddressRecord.postalCode != '-'}" value="#{orderAddressRecord.postalCode}, "/>
               <h:outputText value="#{orderAddressRecord.country}"/>
               </rich:column>
               <rich:column>
               <h:outputText value="#{orderAddressRecord.addressState.id}" />
               </rich:column>
               <rich:column>
               <h:outputText value="#{orderAddressRecord.createDate.time}" converter="dateTimeConverter"/>
               </rich:column>
              
               </rich:subTable>
               <f:facet name="footer">
               <rich:columnGroup>
               <rich:column>#{msgs.rptTotals}</rich:column>
               <rich:column colspan="5" >
               <h:outputText value="#{msgs.rptOrders}: "></h:outputText>
               <h:outputText value="#{totalAddrReport.totalOrders}"></h:outputText>
               </rich:column>
               <rich:column colspan="5" >
               <h:outputText value="#{msgs.rptAddresses}: "></h:outputText>
               <h:outputText value="#{totalAddrReport.totalAddresses}"></h:outputText>
               </rich:column>
               </rich:columnGroup>
               </f:facet>
               </rich:dataTable>
               <rich:datascroller id="orderTxReportTableDs" for="orderTxReportTable" maxPages="20" renderIfSinglePage="false"/>
               </h:panelGrid>
               </h:form>
               </ui:define>
              </ui:composition>
              
              


              Thanks for the help...

              • 4. Re: Frustrating problem with ids (I think)
                ilya_shaikovsky

                So as I told later.. You have binding to the same object and its scope longer than request. So behavior is expected.